邪魔なファイルを除去しつつファイルを固めたくて
find ./hoge -type f | egrep -v '\.[ao]$' | xargs tar cvf hoge.tar
としたけど、なんかファイルが足りないような。
よくよく見てみると、末尾のほうのファイルだけ入っているらしい。
man xargs とかしてみると、
「LINE_MAX 以上は読まれません。適当なところで切られて何度かコマンド実行されます」
的なことが書いてあった。仕方ないので
touch dummy.txt
tar cvf hoge.tar dummy.txt
find ./hoge -type f | egrep -v '\.[ao]$' | xargs tar rvf hoge.tar
とか。なんかもっといい方法ありそうな。
・・・で、「なんかいい方法ないですかー?」という流れで書こうと思ったんですが、よく見ると
The xargs command limits the command line length.
When the constructed command line runs, the combined Argument and environment
lists can not exceed ARG_MAX bytes. Within this constraint, if you do not
specify the -n or the -s flags, the default command line length is at least the
value specified by LINE_MAX.
だそうで。
要するに -s と -n 指定すればいいんですね。何やってんだか。