passing a veriable in a command substitution
Hi,
im trying to do the following: Code:
MYVAR="filename.php" how can i make it work? thanx in advance! |
the substituion works fine, but you have a space after CMSUSER= which means you're making that value null, and then looking to execute the output of the stat command and another command in itself, also not making sense. just remove the space.
|
Hi,
There's a space between = and $(...... Remove the space: CMSUSER= $(stat --format=%U $MYVAR) vs CMSUSER=$(stat --format=%U $MYVAR) Hope this helps |
Thanx,
im kinda newbie to bash :P and sometimes it's difficult to deal with such a strict syntax :D thanx again! |
It might seem strict, but it's not really, it's just illogical. As bash is a shell and not a programming language, each line is a command in it's own right, not a line of code. So whitespace has to matter in certain contexts in a way that a single line of java needn't, as you're actually splitting one operation into two different things with the whitespace.
|
All times are GMT -5. The time now is 11:05 AM. |