1
1

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.

bash: プロセス出力を直接入力ファイルに使う

Last updated at Posted at 2016-01-21

タイトルは意味不明だが、やってること見るとわかってもらえるかも 系

command1 <(command2)

command1プロセスが1番目のパラメータをopenして読み込むと、command2の出力(stdout)が読める

例えばsha1ハッシュで元ファイル--xzの解凍結果を比較したい場合、こう書くとxzをファイルに解凍しなくて済む:

$ sha1sum mmcblk1.img <(xzcat mmcblk1.img.xz)
fb5fcc76ae4d061f3b73ca8c5640ebf14b4b427a  mmcblk1.img
fb5fcc76ae4d061f3b73ca8c5640ebf14b4b427a  /proc/self/fd/11      # xzcatのstdoutはこのfdにパイプされる

逆方向の>() 参照もありますが、機能が|に少しかぶってるため良い使い方考えつかない‥

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?