我需要在 curl 中包含变量
for fname in "assets/*.drx"; do
echo $fname
curl -F file=@"$fname" "http://someurl.com/"
echo $fnamename
done
Run Code Online (Sandbox Code Playgroud)
结果:
assets/5baa5caa414f1d7786e86d03_1545903119.11.drx
curl: (26) couldn't open file "assets/*.drx"
assets/5baa5caa414f1d7786e86d03_1545903119.11.drx
Run Code Online (Sandbox Code Playgroud)
似乎 curl 使用 glob 表达式,但 echo 使用实际文件名。为什么 curl 的行为是这样的?为什么 echo 会看到实际变量以及如何在 curl 中使用文件名?