Given this bash statement:
config_file=""$(dirname "$0")"/config.sh"
Is the expression interpreted as:
"" $(dirname "$0") "/config.sh"
or as:
"$(dirname "$0")"/config.sh
What should be the "proper" way of writing the expression/statement?
CodePudding user response:
It's the first one. You can jump in and out of quotes within the same word and all the adjacent pieces are concatenated.
The leading ""
is removed, and the trailing "/config.sh"
is equivalent to an unquoted /config.sh
since it contains no special characters. The whole thing is therefore the same as:
config_file=$(dirname "$0")/config.sh