最佳答案
当命令是if
语句的一部分时,如何将命令拆分到shell中的多行?
如此:
if ! fab --fabfile=.deploy/fabfile.py --forward-agent --disable-known-hosts deploy:$target; then rc=1
fi
这行不通:
# does not work:
if ! fab --fabfile=.deploy/fabfile.py \
--forward-agent \
--disable-known-hosts deploy:$target; then
rc=1
fi
而不是整个命令执行,我得到:
./script.sh: line 73: --forward-agent: command not found
更重要的是,我对Bash的理解中缺少了什么,这将帮助我在未来理解这个问题和类似的问题?