http - echo in shell script replaces variable with following characters -


when using curl , awk content-length http request, resulting variable gets "erased" when used in echo statement following characters.

why?

#!/bin/sh conf_core_url="http://www.google.com/" cmd_size_target=$(curl -ss -i $conf_core_url | awk '/content-length/ {print $2}') echo "${cmd_size_target}" echo "${cmd_size_target} test" exit 0 

expected output:

222 222 test 

actual output:

222  test 

$cmd_size_target has \r @ end need strip first.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -