Skip to content

Commit

Permalink
add a basic fortune cookie if we don't have one
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonatwork committed Jan 20, 2019
1 parent fca116e commit 6129774
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .profile
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ case "$-" in
PS4='+ '
export PS1 PS2 PS3 PS4

for i in /usr/pkg/games/fortune /usr/games/fortune
do
if [ -x $i ]
then
$i
break
fi
done
unset i
if [ -x /usr/pkg/games/fortune ]
then
/usr/pkg/games/fortune
elif [ -x /usr/games/fortune ]
then
/usr/games/fortune
elif [ -f $HOME/tmp/fortunes -a -f $HOME/tmp/fortunes.count ]
then
awk 'BEGIN { srand(); x=int(rand() * '`cat $HOME/tmp/fortunes.count`') } /^%$/ { x--;next } x==0' $HOME/tmp/fortunes
fi
;;
*)
;;
Expand Down
1 change: 1 addition & 0 deletions .shrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ alias lk="ls -l | grep ^d"
alias ll="ls -l"
alias r="fc -e -"

alias getfortunes='curl -o $HOME/tmp/fortunes https://raw.githubusercontent.com/openbsd/src/master/games/fortune/datfiles/fortunes && grep '^%$' $HOME/tmp/fortunes | wc -l > $HOME/tmp/fortunes.count'
alias fixperms='chmod -R go-rwx "$HOME/.ssh" "$HOME/mail"'

case "$SHELL" in
Expand Down

0 comments on commit 6129774

Please sign in to comment.