【发布时间】:2018-11-11 16:07:19
【问题描述】:
我有一个方法,我正在执行 curl 命令并返回结果。我想将参数传递给这个方法,但它不起作用。
commande_mine() {
local MY_OUTPUT=$(curl -X POST \
http://localhost:5000/myapp \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{
"filepath": "$1"
}')
echo $MY_OUTPUT
}
for f in "/Users/anthony/my files"/*
do
commande_mine $f >> test.txt
break # break first time until everything works as expected
done
如何使用$f 参数传入curl 命令内部的函数?
【问题讨论】: