Re: bash string-operator problem

2019-02-21 Thread Eliot Moss
On 2/21/2019 3:17 PM, Lee wrote: On 2/21/19, john doe wrote: On 2/21/2019 5:18 PM, Lee wrote: On 2/21/19, Rockefeller, Harry wrote: CYGWIN_NT-6.1 HARRYR-PC 3.0.0(0.336/5/3) 2019-02-16 13:21 x86_64 Cygwin $ cat /tmp/x #!/bin/bash A="A" B="A" if [ $A == $B ]; then echo "identical" fi

Re: bash string-operator problem

2019-02-21 Thread Eric Blake
On 2/21/19 2:17 PM, Lee wrote: >> >> One equal sign ('=') should be used instead of two equal signs ('=='). > > The man page for test says you're correct, but just out of curiosity > -- why do two equal signs work? Use of [ ... == ... ] is a bash extension. It works in bash, but is not portable

Re: bash string-operator problem

2019-02-21 Thread Lee
On 2/21/19, john doe wrote: > On 2/21/2019 5:18 PM, Lee wrote: >> On 2/21/19, Rockefeller, Harry wrote: >>> CYGWIN_NT-6.1 HARRYR-PC 3.0.0(0.336/5/3) 2019-02-16 13:21 x86_64 Cygwin >>> GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) >>> >>> #!/bin/bash >>> A="A" >>> B="A" >>> if [

Re: bash string-operator problem

2019-02-21 Thread john doe
On 2/21/2019 5:18 PM, Lee wrote: > On 2/21/19, Rockefeller, Harry wrote: >> CYGWIN_NT-6.1 HARRYR-PC 3.0.0(0.336/5/3) 2019-02-16 13:21 x86_64 Cygwin >> GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) >> >> #!/bin/bash >> A="A" >> B="A" >> if [ $A!=$B ]; then <- needs

Re: bash string-operator problem

2019-02-21 Thread Lee
On 2/21/19, Rockefeller, Harry wrote: > CYGWIN_NT-6.1 HARRYR-PC 3.0.0(0.336/5/3) 2019-02-16 13:21 x86_64 Cygwin > GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) > > #!/bin/bash > A="A" > B="A" > if [ $A!=$B ]; then <- needs spaces around the != > echo -e "not

Re: bash string-operator problem

2019-02-21 Thread Eric Blake
On 2/21/19 10:00 AM, Rockefeller, Harry wrote: > CYGWIN_NT-6.1 HARRYR-PC 3.0.0(0.336/5/3) 2019-02-16 13:21 x86_64 Cygwin > GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) > > #!/bin/bash > A="A" > B="A" > if [ $A!=$B ]; then > echo -e "not identical" > fi > if [ $A==$B ]; then >

bash string-operator problem

2019-02-21 Thread Rockefeller, Harry
CYGWIN_NT-6.1 HARRYR-PC 3.0.0(0.336/5/3) 2019-02-16 13:21 x86_64 Cygwin GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) #!/bin/bash A="A" B="A" if [ $A!=$B ]; then echo -e "not identical" fi if [ $A==$B ]; then echo -e "identical" fi exit 0 Running this script gives not