Is it possible execute chmod and ignore error from command
Example ( remark file.txt not exsist to show the example )
When I type
chmod 777 file.txt
I get error on the output
chmod: cannot access file.txt : no such file or directory
So I add the-f flag to the command as the following: ( file.txt not exist in order to show the case )
chmod -f 777 file.txt
echo $?
1
But from the example chmod return 1
Please advice how to force the chmod command to give exit code 0 in spite of error
2>/dev/null
and useset -e
in scripts.