Re: minor bash script issue

2002-12-12 Thread Hasan Ümit Ezerçe
i remember some scripts that test variables by the following way: if [ "X$1" == "X" ] obviously if $1 is null then the statement is true X==X, and if the variable not null, the statement is false, so if [ "X$1" == "X" ] then echo "arg is null" else echo "arg is $1" fi will work. dbrett wro

Re: minor bash script issue

2002-12-11 Thread dbrett
Thanks to everybody for your help and explainations. I ended up with what I needed and an explaination of how somethings work. I also have a direction on where to learn more thanks again david On Wed, 11 Dec 2002, Robert P. J. Day wrote: > On Wed, 11 Dec 2002, dbrett wrote: > > > Now I am rea

Re: minor bash script issue

2002-12-11 Thread Robert P. J. Day
On Wed, 11 Dec 2002, dbrett wrote: > Now I am really confused! > > This works: > #!/bin/bash > > if [ -z $1 ]; then > echo '' > echo "format is $0 'math equation'" > echo "i.e. $0 (2+2)*3" > echo '' > exit > fi > > echo $1 | /usr/bin/bc -l assuming that

Re: minor bash script issue

2002-12-11 Thread Robert P. J. Day
On Wed, 11 Dec 2002, dbrett wrote: > Nope, unless I missed what you trying to get at. > > #!/bin/bash > > if [$1 == '']; then > echo '' > echo "format is $0 'math equation'" > echo "i.e. $0 (2+2)*3" > echo '' > exit > fi > > echo $1 | /usr/bin/bc -l 2>&1

RE: minor bash script issue

2002-12-11 Thread dbrett
; To: Robert P. J. Day > > Cc: [EMAIL PROTECTED] > > Subject: Re: minor bash script issue > > > > > > I though your correction would work, but the output still gives me the > > error message. I would really like to fix it, but will settle for not > > s

Re: minor bash script issue

2002-12-11 Thread Robert P. J. Day
On 11 Dec 2002, Bret Hughes wrote: > format is ./bc.test.sh 'math equation' > i.e. ./bc.test.sh (2+2)*3 > > [bhughes@bretsony bhughes]$ bc.test.sh (2+2)*3 > bash: syntax error near unexpected token `(2+2)' > [bhughes@bretsony bhughes]$ > [bhughes@bretsony bhughes]$ bc.test.sh '(2+2)*3' > 12 by

Re: minor bash script issue

2002-12-11 Thread dbrett
Now I am really confused! This works: #!/bin/bash if [ -z $1 ]; then echo '' echo "format is $0 'math equation'" echo "i.e. $0 (2+2)*3" echo '' exit fi echo $1 | /usr/bin/bc -l If you notice the only change I made was go with the better test for a blank v

RE: minor bash script issue

2002-12-11 Thread James Francis
> -Original Message- > From: dbrett [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 11, 2002 2:29 PM > To: Robert P. J. Day > Cc: [EMAIL PROTECTED] > Subject: Re: minor bash script issue > > > I though your correction would work, but the output still g

Re: minor bash script issue

2002-12-11 Thread dbrett
I though your correction would work, but the output still gives me the error message. I would really like to fix it, but will settle for not seeing the error. #!/bin/bash if [$1 == '']; then echo '' echo "format is $0 'math equation'" echo "i.e. $0 (2+2)*3" echo

Re: minor bash script issue

2002-12-11 Thread dbrett
Nope, unless I missed what you trying to get at. #!/bin/bash if [$1 == '']; then echo '' echo "format is $0 'math equation'" echo "i.e. $0 (2+2)*3" echo '' exit fi echo $1 | /usr/bin/bc -l 2>&1 /dev/null Here is the output ./math "2 + 3 *( 5 - 3 )" <---

Re: minor bash script issue

2002-12-11 Thread Bret Hughes
On Wed, 2002-12-11 at 12:05, dbrett wrote: > I have a bash to math calucations. It works but also complains about the > last line, even though it works. > > Any ideas how to fix the problem or at least not see the error message and > still work. > > #!/bin/bash > > if [$1 == '']; then >

Re: minor bash script issue

2002-12-11 Thread Robert P. J. Day
On Wed, 11 Dec 2002, Francisco Neira wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > dbrett wrote: > | I have a bash to math calucations. It works but also complains about the > | last line, even though it works. > | > | Any ideas how to fix the problem or at least not see the error

Re: minor bash script issue

2002-12-11 Thread Francisco Neira
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 dbrett wrote: | I have a bash to math calucations. It works but also complains about the | last line, even though it works. | | Any ideas how to fix the problem or at least not see the error message and | still work. | | #!/bin/bash | | if [$1 == ''];

minor bash script issue

2002-12-11 Thread dbrett
I have a bash to math calucations. It works but also complains about the last line, even though it works. Any ideas how to fix the problem or at least not see the error message and still work. #!/bin/bash if [$1 == '']; then echo '' echo "format is $0 'math equation'" e