linux – 无法在当前目录中获取脚本

linux – 无法在当前目录中获取脚本,第1张

概述显然,如果脚本在当前目录中,我无法获取脚本.例如, # source some/dir/script.shOk 工作正常,但如果我和脚本在同一个目录中,则会出错: # cd some/dir# source script.sh-sh: source: script.sh: file not found 是什么赋予了?这是改变目录的唯一方法吗? 如果相关,我在Angstrom Linux上使用 显然,如果脚本在当前目录中,我无法获取脚本.例如,
# source some/dir/script.shOk

工作正常,但如果我和脚本在同一个目录中,则会出错:

# cd some/dir# source script.sh-sh: source: script.sh: @R_502_6852@ not found

是什么赋予了?这是改变目录的唯一方法吗?

如果相关,我在Angstrom linux上使用bash v4.2.10.

解决方法 引用源手册页:

source @R_502_6852@name [arguments]

….

If @R_502_6852@name does not contain a slash,@R_502_6852@
names in PATH are used to find the directory containing @R_502_6852@-
name.

所以……源代码试图在PATH中包含的文件夹中搜索你的script.sh.

如果要在当前文件夹中使用源文件

source ./script.sh
总结

以上是内存溢出为你收集整理的linux – 无法在当前目录中获取脚本全部内容,希望文章能够帮你解决linux – 无法在当前目录中获取脚本所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/1033346.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存