How does string interpolation work in bash? -


i trying interpolate parameter's value in string. let me present simple example generality , simplicity.

size="40" #yes, variable size string echo "total bytes $size" #^ works fine: outputs total bytes: 40 echo "total bytes: $size bytes" #outputs  bytesbytes: 40 #the string " bytes" inserted @ beginning overwriting other string- why? 

i have tried multiple variations of these commands none seem work leading me believe making classic noob mistake. suggestions welcome.

you have saved file crlf line endings.

try dos2unix your_script_file if distro has it.
else solution: sed -i $'s/\r//' your_script_file

i guess script obtained curl, dangerous practice. however, not go details now.

you can pipe curl output through tr -d '\r' getting correct script want.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -