-1

I am trying to assign the path of a file to a variable so I am doing something like:

PATH = dirname script.sh

However I am getting an error. Can someone assist? Thanks.

Sincerely,

Eric Anderson

2
  • May I warn you against overwriting PATH variable? Commented Sep 28, 2011 at 14:18
  • You'd probably be better served creating an alias or a function. Commented Sep 28, 2011 at 14:31

1 Answer 1

4

There can be no spaces between the variable name and the equals sign. Also, I think you meant to run the dirname command, so what you would want is something more like this:

PATH=$(dirname script.sh)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.