Skip to main content

You can negate inside the brace tests also, so to reuse your original code:

# Using || (or)
if [[ ! -f file1 || ! -f file2 || ! -f file3 ]]]]; ;then
    # Do stuff with the files
fi

# Using && (and)
if [[ ! ( -f file1 && -f file2 && -f file3 ) ]]; then
    # doDo stuff with the files
fi

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 || ! -f file2 || ! -f file3 ]] ; then
  # do stuff with the files
fi

You can negate inside the brace tests also, so to reuse your original code:

# Using || (or)
if [[ ! -f file1 || ! -f file2 || ! -f file3 ]]; then
    # Do stuff with the files
fi

# Using && (and)
if [[ ! ( -f file1 && -f file2 && -f file3 ) ]]; then
    # Do stuff with the files
fi
It is possible to declare multiple expressions in a single test
Source Link

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 ]] || [[ ! -f file2 ]] || [[ ! -f file3 ]] ; then
  # do stuff with the files
fi

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 ]] || [[ ! -f file2 ]] || [[ ! -f file3 ]] ; then
  # do stuff with the files
fi

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 || ! -f file2 || ! -f file3 ]] ; then
  # do stuff with the files
fi
Boolean Oops
Source Link
DopeGhoti
  • 79.3k
  • 10
  • 107
  • 141

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 ]] &&|| [[ ! -f file2 ]] &&|| [[ ! -f file3 ]] ; then
  # do stuff with the files
fi

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 ]] && [[ ! -f file2 ]] && [[ ! -f file3 ]] ; then
  # do stuff with the files
fi

You can negate inside the brace tests also, so to reuse your original code:

if [[ ! -f file1 ]] || [[ ! -f file2 ]] || [[ ! -f file3 ]] ; then
  # do stuff with the files
fi
Source Link
DopeGhoti
  • 79.3k
  • 10
  • 107
  • 141
Loading