Skip to content

Instantly share code, notes, and snippets.

@serverwentdown
Last active January 1, 2016 17:49
Show Gist options
  • Save serverwentdown/8179670 to your computer and use it in GitHub Desktop.
Save serverwentdown/8179670 to your computer and use it in GitHub Desktop.
Read the file please...
#!/bin/sh
# fortune.sh 10 print <- prints 10 fortunes on paper.
# fortune.sh 12 <- prints 12 fortunes to cat.
printf "" > tmp.txt
for i in $(eval echo {0..$1 })
do
printf "\n" >> tmp.txt
fortune >> tmp.txt
printf "\n -------&-------" >> tmp.txt
done
printf "\n\n Some fortune sent to you from Ambrose Chua" >> tmp.txt
if [ "$2" = "print" ]
then
lp -o number-up=2 tmp.txt
else
cat tmp.txt
fi
printf "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment