←back to thread

217 points tanelpoder | 1 comments | | HN request time: 0.212s | source
Show context
mfontani ◴[] No.26494650[source]

    set -o noclobber
... works wonders to avoid this.

Sure, one may have to think and replace instances of:

    foo > bar
with:

    foo | tee bar >/dev/null
or:

    rm -f bar ; foo > bar
... but the times the "noclobber" option has _helped_ me more than makes up for the times it's been a nuisance.
replies(2): >>26494822 #>>26500015 #
1. devchix ◴[] No.26494822[source]
And to undo this in the current shell, because of said nuisance:

set +o noclobber

For some reason this is hard for me to remember, because of what the + and - signs have come to symbolize in more recent UI. set +o seems really backward to me, and unset, surprisingly, does not work.

I've commented this line out in all my .rc, because I've found it to be a nuisance without having bought me much. The better principle is do careful work as root, and don't give careless or junior people root. My root PS1 very 'l33t', look and despair:

export PS1="[\[\e[01:31m\u@h\[\e[m\] \W]# "