I am looping through a directory and need to find all files that are not executable. I know
if [ -x $dir ]; then
echo "$dir is an executable file"
fi
shows that it is executable but how do I do the opposite of this? I have tried
if [ !-x $dir ]; then
echo "$dir is not-executable"
fi
however that does not work.
[ !-x $dir ]and[ ! -x $dir ](and you should use[ ! -x "$dir" ]to avoid some surprises).