LoginSignup
0
0

xargsでダブルクォーテーションが取り除かれていた

Posted at

xargsはデフォルトだとダブルクォーテーションが取り除かれてしまうようです。
-0オプションをつけることで残りました。

ls -1 | grep -e /条件/ | cat -n | awk '<cp "xxx yyy.txt" zzz.txtみたいに出力>' ¥
| xargs -0 -i sh -c "{}"

また、最初sh -cevalでできないかと試しましたが、組み込みコマンドらしく利用できないとか。

その他、

  • -t 標準エラー出力に実行されてるコマンドを出力
  • -p dryrunっぽい動き
  • -i placeholder で省略可能なプレイスホルダー(省略時は{})
  • -I placeholder は省略不可能なプレイスホルダー
0
0
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
0
0