Re: SH programming

2005-06-28 Thread Roland Dowdeswell
On 1119834512 seconds since the Beginning of the UNIX epoch "Peter Bako" wrote: > >dayscount=$(expr ($year - 1900) * 365) >echo $dayscount >exit Parenthesis are shell reserved words and hence must be quoted if they are to be passed as arguments to a command, in this case expr. Also, the * is a g

Re: SH programming

2005-06-27 Thread Dimitri
Try escaping the * \* Peter Bako wrote: > Hum, I get a "syntax error: '*' unexpected" > > -Original Message- > From: Michael Erdely [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 26, 2005 6:20 PM > To: Peter Bako > Cc: misc@openbsd.org > Su

Re: SH programming

2005-06-27 Thread Otto Moerbeek
PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of > Otto Moerbeek > Sent: Monday, June 27, 2005 2:08 AM > To: Peter Bako > Cc: misc@openbsd.org > Subject: Re: SH programming > > > On Sun, 26 Jun 2005, Peter Bako wrote: > > > Ok, so this is not really an OpenBSD quest

Re: SH programming

2005-06-27 Thread Tony
Cc: misc@openbsd.org Subject: Re: SH programming On Sun, 26 Jun 2005, Peter Bako wrote: > 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

Re: SH programming

2005-06-27 Thread Otto Moerbeek
eparate arguments, and you need to escape all special shell chars: #!/bin/sh month=$1 day=$2 year=$3 dayscount=`expr \( $year - 1900 \) \* 365` echo $dayscount exit > BTW, obviously I need a good book on SH programming. Any suggestions? For ksh, the Korn Shell Book by David Korn and (iirc Morris Bolsky) comes to mind. -Otto

Re: SH programming

2005-06-26 Thread Rod.. Whitworth
Erdely [mailto:[EMAIL PROTECTED] >Sent: Sunday, June 26, 2005 6:20 PM >To: Peter Bako >Cc: misc@openbsd.org >Subject: Re: SH programming > > >On 6/26/05, Peter Bako <[EMAIL PROTECTED]> wrote: >> dayscount=$(expr ($year - 1900) * 365) > >Try: >dayscount=$((($y

Re: SH programming

2005-06-26 Thread Stephen Marley
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" e

Re: SH programming

2005-06-26 Thread Peter Bako
Hum, I get a "syntax error: '*' unexpected" -Original Message- From: Michael Erdely [mailto:[EMAIL PROTECTED] Sent: Sunday, June 26, 2005 6:20 PM To: Peter Bako Cc: misc@openbsd.org Subject: Re: SH programming On 6/26/05, Peter Bako <[EMAIL PROTECTED]> wrote:

Re: SH programming

2005-06-26 Thread Ted Unangst
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!!! ma

Re: SH programming

2005-06-26 Thread Michael Erdely
On 6/26/05, Peter Bako <[EMAIL PROTECTED]> wrote: > dayscount=$(expr ($year - 1900) * 365) Try: dayscount=$((($year - 1900) * 365)) -- http://erdelynet.com/ Support OpenBSD! http://www.openbsd.org/orders.html

SH programming

2005-06-26 Thread Peter Bako
in/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