I am trying to do some tests to see if I can execute a shell script in a variables contents, similar to the Invoke-Expression function in powershell. I am getting the contents of the variable from curl:
a=$(curl https://some.site/test.sh)
however, whenever I print out the variable, it only gives the last line of the shell script.
Is there something I'm missing here? I'm using echo $a to print the variable.
echo "$a" | wc -land (unquoted)echo $a | wc -l. The former will print the actual line count. The latter will print a result of1. – cas May 13 '21 at 15:21echo "$a"(with quotes) it prints out the entire shell script which is what I was expecting to see, I was usingecho $a. Also how do I tell if it has carriage returns? Its a linux shell script so I'm guessing it should have only \n – john doe May 13 '21 at 15:29