A frequently asked question, both on SO and elsewhere, is using bash for-loop to step through each line of output. I know the answer, and I enjoyed using the following years:
IFS=$'\n'
However, I am a little puzzled by the syntax used. I had a good search / google, but due to the large number of characters that are used / ignored by search engines in the above example, I did not find an explanation.
I also recently noticed this in some outputs from another script. I am having problems echoing from the netcat result. Upon closer examination, it turns out that the exit from nc was in a similar format:
$'Some_Output_Here\r`
I had to disconnect \r , but was not sure of the best way to do this, I ended up using egrep -o ([0-9|aZ]*) . Any better ideas?
source share