【发布时间】:2014-08-04 13:30:05
【问题描述】:
我有一个包含简单“getopts”的脚本。
我发现只有这样称呼它才有效:
bash <(http://domain.com/myscript.sh) -a
为什么这样称呼它不起作用?
curl –L http://domain.com/myscript.sh | bash -s -a
curl 有什么不同的调用方式吗? (除了我提供的)
我不想下载它,只想使用 curl 来执行它。
#!/bin/bash
while getopts ":a" opt; do
case $opt in
a)
echo "-a was triggered!" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
【问题讨论】:
标签: linux bash shell curl getopts