String command not going to variable.
Posted: 2019-02-11 19:45
Hi folks.
If I say:
I get the ls command output, without cr, but I get an output.
If I say:
I get an error, command output not found.
The command without the output="$(....)" returns the correct and expected results.
So, why does the second command, which is correct, not work? I'm guessing there's a clash of ' or ) or ", I've tried loads of combinations but I can't get the output into output.
Many thanks.
If I say:
Code: Select all
output="$(ls -l)"
echo output
If I say:
Code: Select all
output = "$(awk '/Tile/ {match($0, /Tile/); print substr($0, RSTART+5, RLENGTH+20);}' /blender.txt)"
The command without the output="$(....)" returns the correct and expected results.
So, why does the second command, which is correct, not work? I'm guessing there's a clash of ' or ) or ", I've tried loads of combinations but I can't get the output into output.
Many thanks.