by describing my issue, I refer to the following code:
#!/bin/bash
#fileName: subMet.sh
cmd="$(ls -l | cat -n)"
echo $cmd
Then, in the script above I used double quotes to assign a value to cmd
, because I've read that, in this way, it's possibile to preserve spacing and newline characters, in the output. Anyway it doesn't happen.
Can anyone tell me where I am wrong? More, can anyone tell me how to preserve the spacing and newlines?
I hope I have exposed my issue in a decent way, and I thank you in advance.