Skip to main content
3 of 3
added 64 characters in body
Stéphane Chazelas
  • 586.8k
  • 96
  • 1.1k
  • 1.7k

You need to use { list;} instead of (list):

if ! { [ -f file1 ] && [ -f file2 ] && [ -f file3 ]; }; then
  : do something
fi

Both of them are Grouping Commands, but { list;} executes commands in current shell environment.

Note that, the ; in { list;} is needed to delimit the list from } reverse word, you can use other delimiter as well. The space (or other delimiter) after { is also required.

cuonglm
  • 158.2k
  • 41
  • 342
  • 420