I'm debugging a ksh script written by someone else that does the following:
It runs a command and redirects stdout to a file called dberror that already exists using ">". This command fails with the following error:
The file access permissions do not allow the specified action.
dberror: 0403-005 Cannot create the specified file.
The script continues and a couple lines later it deletes the error file like this:
rm -f dberror
The file is successfully deleted but no file permissions are changed in the script.
My question is why the ">" operator can't overwrite the file but the rm -f can delete it? I always thought that anyone who has write permissions on the file could overwrite it with ">".