我在 bash 脚本中有一个 xargs 命令。脚本运行,但返回此警告
xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value
Run Code Online (Sandbox Code Playgroud)
脚本:
function post_thing {
token=$2
##check file exists
if [ -f $1.thing.json ];
then
response=`curl -s -o /dev/null -w "%{http_code}" 'https://url.com' --header 'Authorization: Bearer '"$2"'' --header 'Content-Type: application/json' --data @$1.thing.json`
mv $1.thing.json $1.thing.json.$response
else
echo "File not found: $1.thing.json"
fi
}
export -f post_thing
seq 100 200 | xargs -n2 -P100 -I {} bash -c 'token='"$token"'; post_thing "$@" "$token"' _ {}
Run Code Online (Sandbox Code Playgroud)
我不明白这是否会影响脚本,或者我需要做什么。看起来脚本正在按预期工作。使用 …