Bash, test for presence of two files -


i found this answer works fine, wanted understand why following code won't detect presence of 2 files?

if [[ $(test -e ./file1 && test -e ./file2) ]];   echo "yep" else   echo "nope" fi 

running directly shell works expected:

test -e ./file1 && test -e ./file2 && echo yes 

the output of test -e ./file1 && test -e ./file2 empty string, causes [[ ]] produce non-zero exit code. want

if [[ -e ./file1 && -e ./file2 ]];     echo "yep" else     echo "nope" fi 

[[ ... ]] replacement [ ... ] or test ..., not wrapper around it.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -