Re: Comparing strings

"Michael F. Stemper" <[email protected]> Tue, 13 Jul 2021 16:23:52 -0500
Newsgroups alt.comp.lang.shell.unix.bourne-bash
Organization A noiseless patient Spider
Message-ID <[email protected]>
On 13/07/2021 12.46, ELCV wrote:

> If I do this:
> 
> if [ "$1" != "FOO" ];
>   then
>         echo "I can backup the 2nd volume";
> else
>          exit;
> fi
> 
> It works. But if I add an "or" condition as follows:
> 
> if [ "$1" != "FOO" ]   ||  [ "$1" != "BAR" ] ;

I've never seen this syntax. I always thought that the "or"
needed to be within the test, as in:

if [[ "$1" != "FOO" ||$1 != "BAR" ]]


-- 
Michael F. Stemper
Psalm 94:3-6