I have a script and a file text containing variables for this script in the same directory. I need to read these variables but without this
我有一个脚本和一个文件文本,在同一目录中包含此脚本的变量。我需要阅读这些变量,但没有这个
. /path_to_my_file.file.txt
I don't want any paths inside my script.Doing this does not work
我不希望我的脚本中有任何路径。这样做不起作用
. file.txt
So what other possibilities i have?
那么我有什么其他可能性?
1 个解决方案
#1
1
See this question how to find out in which folder a script is: Unix shell script find out which directory the script file resides?
看到这个问题如何找出脚本在哪个文件夹中:Unix shell脚本找出脚本文件所在的目录?
Afterwards, you can use this path to source your "config" file.
之后,您可以使用此路径来获取“配置”文件。
#1
1
See this question how to find out in which folder a script is: Unix shell script find out which directory the script file resides?
看到这个问题如何找出脚本在哪个文件夹中:Unix shell脚本找出脚本文件所在的目录?
Afterwards, you can use this path to source your "config" file.
之后,您可以使用此路径来获取“配置”文件。