Re: sh script Q

1999-06-09 Thread Vadim Vygonets
Quoth Oleg Goldshmidt on Wed, Jun 09, 1999: > test -w foo && do_sth_with foo > > looks more readable than > > [ -w foo ] && do_sth_with foo For me, [ ] looks more readable, mostly because it has visible boundaries. > and is only 1 char longer, and is shorter than > > if [ -w foo ]; then do_s

Re: sh script Q

1999-06-09 Thread Vadim Vygonets
Quoth Vadim Smelyansky on Wed, Jun 09, 1999: > On Tue, 18 May 1999, Vadim Vygonets wrote: > VV>Anyway, does anybody in this world use 'test' instead of '['? > For what? for longer strings in script? :) > > FYI usually "/usr/bin/[" it is hardlink to "/usr/bin/test" I know it. And in sane

Re: sh script Q

1999-06-09 Thread Oleg Goldshmidt
Vadim Smelyansky <[EMAIL PROTECTED]> writes: > On Tue, 18 May 1999, Vadim Vygonets wrote: > > VV>Anyway, does anybody in this world use 'test' instead of '['? > For what? for longer strings in script? :) test -w foo && do_sth_with foo looks more readable than [ -w foo ] && do_sth_with

Re: sh script Q

1999-06-09 Thread Vadim Smelyansky
On Tue, 18 May 1999, Vadim Vygonets wrote: VV>Anyway, does anybody in this world use 'test' instead of '['? For what? for longer strings in script? :) FYI usually "/usr/bin/[" it is hardlink to "/usr/bin/test" -- Vadim Smelyansky (AKA Proglot) cellular:+972-54-876933 Wide Networking S

Re: sh script Q

1999-05-19 Thread Adam Morrison
Ariel Biener wrote: > To all the helpfull people: I don't care to participate in religious wars, which is basically what this thread is about. But factual mistakes need to be corrected. > I believe that when you create shell scripts, they'd better be generic, > unless there is a special reason

Re: sh script Q

1999-05-18 Thread Ariel Biener
On Tue, 18 May 1999, Adam Morrison wrote: To all the helpfull people: I believe that when you create shell scripts, they'd better be generic, unless there is a special reason, and if there is, it should be documented in the script. (like using functions, which work in bash/ksh, but not in the

Re: sh script Q

1999-05-18 Thread Gaal Yahas
On Tue, May 18, 1999 at 08:09:40PM +0300, Vadim Vygonets wrote: > Anyway, does anybody in this world use 'test' instead of '['? [gaal@derain ~]$ ls -l /usr/bin/[ /usr/bin/test lrwxrwxrwx 1 root root4 Mar 26 00:50 /usr/bin/[ -> test -rwxr-xr-x 1 root root16856 Aug

Re: sh script Q

1999-05-18 Thread Adam Morrison
Ariel Biener wrote: > Which will result in the script fo fail if $PARAM is undefined. > > Vadim's suggestion wasn't just a matter of semantics. > > --Ariel > > Vadim Vygonets <[EMAIL PROTECTED]> writes: > > > > > > [ "$PARAM" != "SOMETHING" ] || { > > > > ;} > > > I think that it's better to do

Re: sh script Q

1999-05-18 Thread Vadim Vygonets
Quoth Ariel Biener on Tue, May 18, 1999: > Which will result in the script fo fail if $PARAM is undefined. > > Vadim's suggestion wasn't just a matter of semantics. I don't think that on all Unices "$PARAM" (enclosed in double quotes) will yield nothing. On some Unices it will yield an empty ar

Re: sh script Q

1999-05-18 Thread Alexander L. Belikoff
Ariel Biener <[EMAIL PROTECTED]> writes: > On 18 May 1999, Chmouel Boudjnah wrote: > > > Which will result in the script fo fail if $PARAM is undefined. Not quite: $ echo $SHELL /bin/bash $ if [ "$foobar" != "something" ] ; then echo nothing; fi nothing $ ksh $ if [ "$foobar" != "something"

Re: sh script Q

1999-05-18 Thread Ariel Biener
On 18 May 1999, Chmouel Boudjnah wrote: Which will result in the script fo fail if $PARAM is undefined. Vadim's suggestion wasn't just a matter of semantics. --Ariel > Vadim Vygonets <[EMAIL PROTECTED]> writes: > > > > [ "$PARAM" != "SOMETHING" ] || { > > > ;} > > I think that it's better to

Re: sh script Q

1999-05-18 Thread Chmouel Boudjnah
Vadim Vygonets <[EMAIL PROTECTED]> writes: > > [ "$PARAM" != "SOMETHING" ] || { > > ;} > I think that it's better to do: > if [ "X$PARAM" != "XSOMETHING" ]; then . Yes you right it's more unix, but i usually use the "$PARAM" != "SOME". -- MandrakeSoft http://www.mandrakesoft.com

Re: sh script Q

1999-05-18 Thread Vadim Vygonets
Quoth Chmouel Boudjnah on Tue, May 18, 1999: > [ "$PARAM" != "SOMETHING" ] || { > ;} I think that it's better to do: if [ "X$PARAM" != "XSOMETHING" ]; then . Or, if you check for an enpty string, if [ "X$PARAM" != "X" ]; then . Vadik. -- The ill-formed Orange Fails to satisfy the eye:

Re: sh script Q

1999-05-16 Thread Oleg Goldshmidt
Mike Almogy <[EMAIL PROTECTED]> writes: > Does any one know how can i check if a varible contain any data ,using > sh script. > > something like if ($param ne ""){} in perl. man test? E.g. if [ "$PARAM" != "" ] then ... else ... fi or if [ -z "$PARAM" ] then ... else ... fi

sh script Q

1999-05-16 Thread Mike Almogy
Hi, Does any one know how can i check if a varible contain any data ,using sh script. something like if ($param ne ""){} in perl. Thanks. Mike Almogy Mofet System Administrator. Pho :972-03-6901417 Cel :972-052-562237 Fax :972-03-6901414