![]()
#!/bin/sh
#calc: use bc to calculate any legal bc mathematical expression
case $2 in
"") SCALE=2 ;;
*) SCALE=$2 ;;
esac
(echo scale=$SCALE;echo "$1")|bc
$ calc "(10*4/2)+3"
23.00
$
#!/bin/sh
#todo: print a list of things to do today
todofile=$HOME/todo
cvtday()
{
case $day in
01) day=1;;
02) day=2;;
03) day=3;;
04) day=4;;
05) day=5;;
06) day=6;;
07) day=7;;
08) day=8;;
09) day=9;;
esac
case $day in
1?) day=$day"th";;
*1) day=$day"st";;
*2) day=$day"nd";;
*3) day=$day"rd";;
*) day=$day"th";;
esac
}
set `date +'%A %d %B %Y'`
day=$2
cvtday
today="$1 $day $3 $4"
set `date +'%A %d %B %Y' —date '1 day'`
day=$2
cvtday
tomorrow="$1 $day $3 $4"
sed -n -e '/'"$today"'/,/'"$tomorrow"'/p' < $todofile | sed -e '/'"$tomorrow"'/d'
#!/bin/sh
cd $HOME/chess || exit 1
case $1 in
"")
echo 1>&2 'no arg: using level 5 (5 mins per side)'
time='time sd/5';ponder='ponder off' ;;
[1-9]*)
time='time sd/$1';ponder='ponder off' ;;
blitz)
time='time sd/5';ponder='ponder on' ;;
quick)
time='time sd/30';ponder='ponder on' ;;
tourney)
time='time 40/150/30/60';ponder='ponder on' ;;
*)
echo 1>&2 'invalid arg: using level 5 (5 mins per side)'
time='time sd/5';ponder='ponder off' ;;
esac
replace 'time .*' "$time" .craftyrc
replace 'ponder .*' "$ponder" .craftyrc
exec /usr/local/bin/crafty
[back to Scripts index] [back to Linux, Unix, etc] [Main Site] [Weblog]
Contents licensed under the GPL