1
paulw54jrn 2014-09-09 08:15:55 +08:00 3
搬运http://zsh.sourceforge.net/Doc/Release/Redirection.html
>| word >! word Same as >, except that the file is truncated to zero length if it exists, even if CLOBBER is unset. |
2
yangg 2014-09-09 09:16:12 +08:00
@paulw54jrn Is it zsh only?
|
3
pfitseng 2014-09-09 09:28:52 +08:00 3
http://en.wikipedia.org/wiki/Clobbering
$ echo "Hello, world" >file.txt $ echo "This will overwrite the first greeting." >file.txt $ set -o noclobber $ echo "Can we overwrite it again?" >file.txt -bash: file.txt: cannot overwrite existing file $ echo "But we can use the >| operator to ignore the noclobber." >|file.txt $ # Successfully overwrote the contents of file.txt using the >| operator $ set +o noclobber # Changes setting back |
4
ETiV OP |