1
paulw54jrn 2014 年 9 月 9 日 搬运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 年 9 月 9 日
@paulw54jrn Is it zsh only?
|
3
pfitseng 2014 年 9 月 9 日 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 |