I suppose almost everybody put '>' instead of '>>' to redirect the output to file.
In bash it's possible to set noclobber option to avoid file overwriting.
$touch test $set -o noclobber $echo test > test bash: test: cannot overwrite existing fileIf you really know what you are doing you you can use '>|' to overwrite the file successfully.
$set -o | grep noclobber noclobber on $echo test >| test $cat test testVery useful option and I think it should be on by default.
No comments:
Post a Comment