parsed.org
No Clobber File! by xinu on Feb 27, 2007 12:02 PM

Have you ever entered a command that involved redirection and just stared at it, palms sweating, heart racing, hoping against hope that, after all the variables interpolate, it doesn't destroy any of your crucial system files sitting nearby?

Enter: noclobber

If you're using the Bash shell, you can set this option to prevent overwriting of existing files. To see your current settings:

bash-2.05$ set -o
allexport       off
braceexpand     on
errexit         off
hashall         on
histexpand      on
keyword         off
monitor         on
noclobber       off
...

To set noclobber:

bash-2.05$ set -o noclobber
bashnoclobbershell
RSS