zshだと簡単で>!
でファイルを上書きすることができます。
通常は、以下のコマンドでは出力先がある場合、上書きすることができません。
$ touch test.txt
$ echo hello > test.txt
しかし、zsh
だと以下のように上書きできます。
$ touch test.txt
$ echo hello >! test.txt
$ cat test.txt
hello
More than 5 years have passed since last update.
zshだと簡単で>!
でファイルを上書きすることができます。
通常は、以下のコマンドでは出力先がある場合、上書きすることができません。
$ touch test.txt
$ echo hello > test.txt
しかし、zsh
だと以下のように上書きできます。
$ touch test.txt
$ echo hello >! test.txt
$ cat test.txt
hello
Register as a new user and use Qiita more conveniently