Previous: ~/.ponysayrc, Up: Advanced usage [Contents][Index]
The following will not work if you have line breaks in you file names, but if you do have that, you may want to rethink that as it will usually cause problems for programs, especially for shell scripts.
The command __pony=$(ponysay -o 3>&1 1>/dev/null | grep ^pony\ file: |
sed -e s/^pony\ file:\ //g) && (ponysay -of "$__pony" | ponythink -Wn -f "$__pony")
will give you a pony thinking of herself. The command works on GNU Bash, but may
not work on less POSIX compatible shells. It works by first getting a random pony and
use the extra information printed the file descriptor 3 (see Extra information),
and fetchs the file name with help of grep
and sed
. The file
name is stored in a shell variable. It the pipes one an execute of ponysay into
another executing, using the stored file anme in both executions. This does not
work on FISH shell because os POSIX incompatibility.
Ponysay can use just about anything as a message because it quarantines the message’s ANSI escape sequences, including colour. And is Unicode aware (including combining characters) and ANSI escape sequence aware.
Naturally this means that you can also make ponies think of eachother,
for example: ponysay -f rarity -b round 'My little Spiky-wiky' |
ponythink -f spikefloat -b unicode -W n