我有一个shell脚本说test.sh
,我可以使用command
和shell
模块调用它们。但是test.sh
以source ../properties/Main.sh
方式在内部调用另一个shell脚本。
我正在尝试使用ansible执行test.sh但是,执行暂停"No such file or directory"
错误,因为源是内部shell命令。
test.sh看起来像这样
#/bin/bash
free -m
#echo $PWD
source ../Properties/Main.sh
#
#Remaining Part of the Script
任何帮助都将不胜感激。
为了进一步澄清,如果您认为Main.sh
不在正确的路径中,那么
我收到file not found
错误,然后你错过了这一点。以下注释中提到的Automation_v1
目录包含许多用于组织脚本的目录。
答案 0 :(得分:0)
我找到了解决方案,
提供绝对路径而不是source
Main.sh
的相对路径是关键。