On Sun, Jun 26, 2005 at 09:32:36PM -0400, Ted Unangst wrote: > On Sun, 26 Jun 2005, Peter Bako wrote: > > > #!/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!!! > > man sh says arithmetic expressions take double parens: > > dayscount=$((($year - 1900) * 365)) > > don't forget about leap years.
Traditional Bourne shell doesn't have arithmetic substitutions so it would be done with expr like this: dayscount=$(expr $(expr $year - 1900) \* 365) or even: dayscount=`expr \`expr $year - 1900\` \* 365` This only matters if your script needs to be portable. -- stephen