find . -print0 | xargs -0 echo ― 2007年05月16日 20時28分37秒
ディレクトリ名に0x20(空白)が入るMac OS X環境でfindに-print0を使わずにxargsで受け取るのはヤバい。
% man find
-print This primary always evaluates to true. It prints the pathname of
the current file to standard output. If none of -exec, -ls,
-print0, or -ok is specified, the given expression shall be
effectively replaced by ( given expression ) -print.
-print0
This primary always evaluates to true. It prints the pathname of
the current file to standard output, followed by an ASCII NUL
character (character code 0).
-0 Change xargs to expect NUL (``\0'') characters as separators,
instead of spaces and newlines. This is expected to be used in
concert with the -print0 function in find(1).
これは知らなかった。普段は空白を含まないから全然問題になってなかったので。
コメント
トラックバック
このエントリのトラックバックURL: http://uyota.asablo.jp/blog/2007/05/16/1511536/tb
※なお、送られたトラックバックはブログの管理者が確認するまで公開されません。
コメントをどうぞ
※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。
※なお、送られたコメントはブログの管理者が確認するまで公開されません。