I wanted to concatenate two variables, but it seems that there is some overwriting.
#!/bin/bash NUMBER1=$(seq 1 900 | sort -R | head -1) FIRST=$(sed -n ''$NUMBER1'p' names.txt) echo ${FIRST} echo "${FIRST}${NUMBER1}" Where names.txt is a list of names. For example when I run this code, I get the output as,
Gregoria
159goria
Notice $FIRST was partially overwritten by $NUMBER1 .
The correct output should have been,
Gregoria
Gregoria159
can someone please help me ? Thanks
dos2unixor some other utility to remove CRs. For example,dos2unix names.txtmight help.names.txtcontent