[英]Read variables from text file to shell script
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? 那我还有什么其他可能性呢?
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. 之后,您可以使用此路径来获取“ config”文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.