0

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?

3
  • No other possibility, possibly. Commented Feb 26, 2014 at 17:00
  • is it possible to define the path as a global variable using export ? Commented Feb 26, 2014 at 17:02
  • You can use an environment variable... export HERE=/users/fred/bloggs and then use ${HERE} in your script. Commented Feb 26, 2014 at 17:16

1 Answer 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?

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.