
例えば、
# a demonstration of the functionality
cat dependencies | xargs -n 1 pip install -U
# expressed as a non-simple, pipeless one liner
awk '{system("pip install -U $0")}' dependencies
1つのフラグでこれを行うには、いくつかのコマンドが必要になりますが、それが何であるかわかりません。そんなことありますか?
答え1
pip install -U
各行の内容を追加の引数として1回呼び出すにはGNUが必要xargs
です。
xargs -rd '\n' -n1 -a dependencies pip install -U
-d '\n'
一つもなく言葉に渡されたファイルで独自の見積処理を実行することにpip install -U
注意してくださいxargs
(現代のシェルの見積処理とは異なります)。
答え2
おそらくあなたはただ次のようになります:
xargs -n 1 pip install -U < dependencies
# or perhaps more readable:
<dependencies xargs -n 1 pip install -U
# and if you don't want to | bash it:
<dependencies xargs -I% -d" " -n 1 bash -c "pip install -U %"