linux系统shell脚本显示找不到文件怎么解决
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,linux系统shell脚本显示找不到文件怎么解决?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。linux source shell脚本
千家信息网最后更新 2025年12月02日linux系统shell脚本显示找不到文件怎么解决
linux系统shell脚本显示找不到文件怎么解决?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
linux source shell脚本显示找不到文件
例子:
[root@localhost osc]# sh a.sh a.sh: line 4: source: 1.sh: file not found[root@localhost osc]# cat a.sh #!/bin/bashcd /data/osc/bin/if [ -f 1.sh ];thensource 1.shfi
刚开始,还以为权限问题,然后给权限,但结果还是一样
man source ,找到原因了。source时找filename的问题。
source 命令找filename是在当前的shell环境下找的,如果没有反斜线,就在path中找,如果没有就没有。
source filename [arguments] Read and execute commands from filename in the current shell environment and return the exit status of the last command exe- cuted from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing file- name. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read.
如下方式都可以:
1、将脚本所在的目录加到PATH中
2、加上相对路径或绝对路径
3、就算是当前目录也得加./
看完上述内容,你们掌握linux系统shell脚本显示找不到文件的解决方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!
脚本
问题
文件
系统
内容
原因
方法
更多
权限
目录
路径
束手无策
为此
例子
命令
对此
所在
技能
斜线
方式
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
软件开发岗试岗期注意什么
密码保管箱 网络安全
javaee怎么连上数据库
阳泉软件开发培训机构
保障网络安全畅通
数据库写入缓存
soa软件开发薪资
数据库文件没有任何外在程序
中国书法家协会会员查询数据库
网络安全大赛ctf
网龙网络技术 广州 有限公司
数据库表内容的增删改
北京广联先锋网络技术有
四川应用软件开发如何收费
软件开发走什么会计科目
软件开发商务信息咨询广告设计
软件开发外包公司有哪些
服务器网卡驱动哪个好
网络技术服务的公司
软件开发线上培训
风电场网络安全区域划分说明
常用服务器的运用
中国书法家协会会员查询数据库
网络安全大赛中国第一是谁
服务器异常500ml有哪些原因
echarts接入数据库数据
兴安盟网络安全教育平台
中小学生与家庭的网络安全
文本框怎么显示表格数据库
监控视频数据库列