while read myline
do
echo $myline >> /home/aauytrf/PARM_FILE_NM.bak
done < /home/aauytrf/PARM_FILE_NM.prm
One more point the script does not contain #! as the first line, so I am not sure whihc interpreter is used to execute. My script is called from another script which has #!/usr/bin/ksh, so I think it is korn shell.
Not sure I understand. What output is "0"? Do you have a line
0
in your .bak file? Pls post more meaningful input and output samples, and maybe an execution log of your script. From what I see in your post, there's no indication of sth. going wild.
#!/bin/bash
while read myline
do
echo $myline
done < test.txt
+ read myline
+ echo a
a
+ read myline
+ echo a b
a b
+ read myline
+ echo a b a b
a b a b
+ read myline
+ echo a b
a b
+ read myline
+ echo No.Brackets.Bla.Bla
No.Brackets.Bla.Bla
+ read myline
+ echo '[NO_PERIODS]'
[NO_PERIODS]
+ read myline
+ echo '[NO.UNDERSCORE]'
[NO.UNDERSCORE]
+ read myline
+ echo
+ read myline
So I think what happens is that the ^[ or [bl la] is being interpreted as a type of non ASCII character. When I tranpose the brackets on either side of your original string...it shows up...
#!/bin/bash
while read myline
do
echo $myline
done < test.txt
+ read myline
+ echo a
a
+ read myline
+ echo a b
a b
+ read myline
+ echo a b a b
a b a b
+ read myline
+ echo a b
a b
+ read myline
+ echo No.Brackets.Bla.Bla
No.Brackets.Bla.Bla
+ read myline
+ echo '[NO_PERIODS]'
[NO_PERIODS]
+ read myline
+ echo '[NO.UNDERSCORE]'
[NO.UNDERSCORE]
+ read myline
+ echo ']ASD_HAGDF_CSAS_CMPPRD.s_PRDPR_STNNSTN_CSAS_SRCTPP_COMMHIST006_INC_dat_LD['
]ASD_HAGDF_CSAS_CMPPRD.s_PRDPR_STNNSTN_CSAS_SRCTPP_COMMHIST006_INC_dat_LD[
+ read myline
That quote is referring to the read C library function, not the shell's read command. Two different things.
I cannot reproduce your test. When running that code snippet on your test.txt file, lines are output as is except for some whitespace removal.
The code snippet I pasted was only the portion of code whihc I had issue. There are more processing happening inside while loop, but none of those statments is responsible for input line being changed to "0" while doing doing echo. This is why I dint paste them. This is not just a backing up of file.
For your question "Not sure I understand. What output is "0"? Do you have a line " answer is "0" is what is the output from echo statement.
And there is no other output from logfile.