I am in the bash shell, BSD unix, under macos, but I think this would apply to many other unix shells. The noclobber
option can be useful at times:
> find . -name z
> set -o noclobber
> echo "dog" > z
> echo "dog" > z
-bash: z: cannot overwrite existing file
But how do I un-set it, without launching a new shell?
Curiously, bash undo set noclobber
, unix un-do set noclobber
, and similar searches did not quickly bring up an answer.
None of the following work:
> unset -o noclobber
-bash: unset: -o: invalid option
unset: usage: unset [-f] [-v] [name ...]
> unset noclobber
> echo "dog" > z
-bash: z: cannot overwrite existing file
> set -o clobber
-bash: set: clobber: invalid option name
echo dog >| z
– Kusalananda Jun 06 '20 at 19:15