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
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
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
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
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
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
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
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:
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
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
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
11 matches
Mail list logo