說我要touch
六個文件CONCAT字符串通過xargs的變量
one.html
one.css
two.html
two.css
three.html
three.css
如何使用xargs
這個?我正在查看手冊頁,但我不確定獲取stdin管道的語法。
$ echo one two three | xargs -n 1 touch $1.html $1.css // nope
說我要touch
六個文件CONCAT字符串通過xargs的變量
one.html
one.css
two.html
two.css
three.html
three.css
如何使用xargs
這個?我正在查看手冊頁,但我不確定獲取stdin管道的語法。
$ echo one two three | xargs -n 1 touch $1.html $1.css // nope
這是比較容易通過shell IST做:
touch {one,two,three}.{css,html}
這將創建6個文件:
one.css one.html two.css two.html three.css three.html
替代與循環
for f in one two three; do touch $f.html $f.css; done
如果是重要的是使用xargs
:
printf "%s\n" one two three | xargs -I{} touch {}.html {}.css
'max xargs' .... –