How to use noclobber with the tcsh shell on UNIX and Linux
This example using the
set noclobber command prevents existing files from being overwritten.
2:04am ubuntu /home/ubuntu ~> set noclobber
Now if I try to redirect to the file, this happens.
2:04am ubuntu /home/ubuntu ~> echo "" > chan.c chan.c: File exists.
This prevents accidental file overwriting when experimenting with redirection.
But you can still erase the file with the rm command.
2:08am ubuntu /home/ubuntu ~> rm chan.c 2:08am ubuntu /home/ubuntu ~> ls chan.c ls: cannot access chan.c: No such file or directory
This is how to override this setting if need be. Use the echo “hello” >! ip.txt command to force a write to an existing file.
2:09am ubuntu /home/ubuntu ~> echo "hi" >! chan.c 2:10am ubuntu /home/ubuntu ~> cat chan.c hi
This is how I got my awesome tcsh shell prompt. This one is rather nice.
set prompt = "%t %n %/ %~%# "
Get more information about the tcsh shell here: http://www.acm.uiuc.edu/workshops/cool_unix/tcsh-startup.html.