17 lines
461 B
Bash
Executable File
17 lines
461 B
Bash
Executable File
#!/bin/bash
|
|
cowsaidfile="$(mktemp)"
|
|
cowsay "E T E R N A L" > "$cowsaidfile"
|
|
trap_exit() {
|
|
cat "$cowsaidfile"
|
|
rm "$cowsaidfile"
|
|
}
|
|
trap trap_exit EXIT
|
|
while true; do
|
|
# Shut up shellcheck; that's the whole point. cowsay does a full read
|
|
# before it writes back to the file anyway.
|
|
# shellcheck disable=2094
|
|
cowsay -n < "$cowsaidfile" 1<> "$cowsaidfile"
|
|
printf "%s bytes of cowsay; hit Ctrl+C to dump them\\n" \
|
|
"$(stat --printf="%s" "$cowsaidfile")"
|
|
done
|