使用curl如下所示:
bash <(curl -s https://raw.githubusercontent.com/user/repo/master/script.sh | tr -d '\r')我执行了一些远程脚本。
远程脚本包括以下两个方面:
1)命令:
wget -P ~/myAddons/ https://raw.githubusercontent.com/user/repo/master/appendix.sh2) source ~/myAddons/appendix.sh命令:
这个文件appendix.sh,包括一些Bash别名。
在执行远程脚本之后,我尝试使用appendix.sh中的一些别名。都没起作用。
只有在手动执行source ~/myAddons/appendix.sh之后,别名才能工作。
source命令和手动命令是否相同。为什么直接从远程脚本执行source ~/myAddons/appendix.sh失败了,而手动执行却成功了,如何正确地处理这个问题呢?
发布于 2018-01-28 07:52:35
您将使用bash <(...)启动一个新的外壳,然后在其中进行采购。这不会影响运行bash <(...)的原始shell。您应该将进程替换为source:
source <(...)
# or
. <(...)https://unix.stackexchange.com/questions/420152
复制相似问题