OSTYPE=linux
OS_KERNEL_VERSION=3.10.0
csh
When I try to clobber an existing file using redirect ">" I get an error... "File exists."
% date > the.log
% echo $?
0
% date > the.log
the.log: File exists.
% echo $?
1
How can I simply force the clobber of "the.log" without getting the error ?
Update: This appears to be happening on one server but not others. So it's a server specific thing... some sort of config setting ?
CodePudding user response:
In linux you cannot have two files with same name,once check using ls commadn,if you dont want error give % date > the.log 2>&1 for both error and sucess to fall to log file
CodePudding user response:
Thanks Harish for the reply. But vgersh99 got it right (the 2nd time). For csh, you need the '!'. Something to do with a noclobber setting in the shell.