Ok, so this is not really an OpenBSD question but I am doing this on an
OpenBSD system and I am about to lose my mind...

I have done some basic shell scripting before but I've not had to deal with
actual integer math before and now it is killing me.  The script takes a
parameter in (year number) and is supposed to subtract 1900 from it and then
multiply the result by 365.  (This is part of a larger script that deal with
converting dates to a single numeric value, but this one problem is an
example of the problems I am having with this entire script.)  So, this is
what I have:

#!/bin/sh
month=$1 
day=$2
year=$3

dayscount=$(expr ($year - 1900) * 365)
echo $dayscount
exit

This will generate a "syntax error: `$year' unexpected" error.  I have tried
all sorts of variations and I am not getting it!!!  HELP!!!

BTW, obviously I need a good book on SH programming.  Any suggestions?

Thanks,
Peter

Reply via email to