简体   繁体   中英

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?

Afterwards, you can use this path to source your "config" file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM