开发者

Unix: assign variable to command

开发者 https://www.devze.com 2023-04-09 15:44 出处:网络
I am trying to assign the path of a file to a variable so I am doing something like: PATH = dirname script.sh

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 g开发者_如何学Pythonetting an error. Can someone assist? Thanks.

Sincerely,

Eric Anderson


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)
0

精彩评论

暂无评论...
验证码 换一张
取 消