Re: Possible bash incompatibility

2005-04-18 Thread Arash Partow
Hi all
Brian was correct it turns out there was another grep on my path,
its all been resolved now.
thanx all!
Arash
__
Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.
http://www.partow.net

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/


Re: Possible bash incompatibility

2005-04-18 Thread RuiXian BAO
Hello,

On 4/18/05, Brian Dessent <[EMAIL PROTECTED]> wrote:
> Arash Partow wrote:
> 
> > error message:
> > bash-2.05b$ ./test.sh
> > ./test.sh: line 3: [: too many arguments
> > Target platform is NOT Win32 via CYGWIN
> > bash-2.05b$
> 
> WJFFM:
> 
> $ ./test.sh
> Target platform is Win32 via CYGWIN
> 
> (both 1 and "1" work the same without error)

The script works for me, 

[EMAIL PROTECTED] ~
$ ./test.sh
Target platform is Win32 via CYGWIN

[EMAIL PROTECTED] ~
$

Best

Bao

> Are you sure that the grep in your path is Cygwin's grep?
> 
> Brian

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Possible bash incompatibility

2005-04-18 Thread Christopher Faylor
On Mon, Apr 18, 2005 at 10:59:10AM -0400, Igor Pechtchanski wrote:
>On Mon, 18 Apr 2005, Arash Partow wrote:
>>Could someone tell me why the piece of bash script below is being
>>rejected as being erroneous on cygwin but works fine on other bash's
>>ie: linux and openbsd?
>
>I would imagine because the output of "uname -s" doesn't contain
>"CYGWIN" on either Linux or OpenBSD, so "grep -c" outputs a 0.  But
>even on Cygwin this works (as Brian already confirmed).
>
>>my current version of bash is update (2.05b).
>>
>>#!/bin/bash
>>
>>if [ `uname -s | grep -c 'CYGWIN'` -eq "1" ]; then
>
>FWIW, a better test would be
>
>if uname -s | grep -q 'CYGWIN'; then ...

How about

if [[ $(uname -s) == CYGWIN* ]]; then

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Possible bash incompatibility

2005-04-18 Thread Igor Pechtchanski
On Mon, 18 Apr 2005, Arash Partow wrote:

> Hi all,
>
> Could someone tell me why the piece of bash script below is being
> rejected as being erroneous on cygwin but works fine on other bash's
> ie: linux and openbsd?

I would imagine because the output of "uname -s" doesn't contain "CYGWIN"
on either Linux or OpenBSD, so "grep -c" outputs a 0.  But even on Cygwin
this works (as Brian already confirmed).

> my current version of bash is update (2.05b).
>
> #!/bin/bash
>
> if [ `uname -s | grep -c 'CYGWIN'` -eq "1" ]; then

FWIW, a better test would be

if uname -s | grep -q 'CYGWIN'; then ...

> printf "Target platform is Win32 via CYGWIN\n";
> else
> printf "Target platform is NOT Win32 via CYGWIN\n";
> fi
>
> error message:
> bash-2.05b$ ./test.sh
> ./test.sh: line 3: [: too many arguments
> Target platform is NOT Win32 via CYGWIN
> bash-2.05b$

You could try "set -x" to see the actual command that is executed...  It
could be due to some stderr output from either uname or grep.
In any case, other than the output of "uname" containing CYGWIN (i.e.,
changes in data), none of the above is Cygwin-specific.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Possible bash incompatibility

2005-04-18 Thread Brian Dessent
Arash Partow wrote:

> error message:
> bash-2.05b$ ./test.sh
> ./test.sh: line 3: [: too many arguments
> Target platform is NOT Win32 via CYGWIN
> bash-2.05b$

WJFFM:

$ ./test.sh 
Target platform is Win32 via CYGWIN

(both 1 and "1" work the same without error)

Are you sure that the grep in your path is Cygwin's grep?

Brian

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: Possible bash incompatibility - update

2005-04-18 Thread Arash Partow
Sorry the script should have been:
#!/bin/bash
if [ `uname -s | grep -c 'CYGWIN'` -eq 1 ]; then
printf "Target platform is Win32 via CYGWIN\n";
else
printf "Target platform is NOT Win32 via CYGWIN\n";
fi
Still the same error message etc...
Arash Partow
__
Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.
http://www.partow.net

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/