i have 3 variables:
var1="file1" var2="file2" var3="file3" how use , (&&) operator in if statement this:
if [ -f $var1 && -f $var2 && -f $var3 ] ... fi when write code gives error. right way?
so make expression work, changing && -a trick.
it correct this:
if [ -f $var1 ] && [ -f $var2 ] && [ -f $var3 ] .... or like
if [[ -f $var1 && -f $var2 && -f $var3 ]] .... or even
if [ -f $var1 -a -f $var2 -a -f $var3 ] .... you can find further details in question bash : multiple unary operators in if statement , references given there what difference between test, [ , [[ ?.
Comments
Post a Comment