22
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

teeでgz圧縮しながら保存する

Last updated at Posted at 2015-03-10

↓こんな感じにすればOK。一時ファイルも出来ないので便利です。

echo hoge | tee >(gzip -c >hoge.gz)

仕組みとしては Bash の Process Substitution っていう機能を使ってます。

よく「2つのコマンドの出力結果のdiffを取る」とかを例示して紹介される機能ですが、「サブシェルの出力を入力として使う例」はよく見るけど「出力をサブシェルの入力に使う例」はあまり見ないなーと思ったので、僕がたまに使うケースを例に紹介してみた。

22
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?