Re: Comparing strings

"Michael F. Stemper" <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.