Skip to content

Instantly share code, notes, and snippets.

@yuitest
Created April 11, 2014 16:54
Show Gist options
  • Save yuitest/10483978 to your computer and use it in GitHub Desktop.
Save yuitest/10483978 to your computer and use it in GitHub Desktop.
引数を標準入出力につなぎ替えて、残りの引数を実行するシェルスクリプト
#!/bin/sh
exec < $1
shift
exec >> $1
shift
exec $*
@yuitest
Copy link
Author

yuitest commented Apr 11, 2014

hoge arg1 arg2 ... < foo.txt >> bar.txt

/path/to/stdiocontrol.sh foo.txt bar.txt hoge arg1 arg2 ...
と等しい。

@yuitest
Copy link
Author

yuitest commented Apr 11, 2014

だってー sh -c でやるの大変なんだもーん

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment