Suppose that I have a program make_ndx
that outputs via the -o
switch. I would like to call myprogram
from a bash shell script and output two files, out1.ndx
and out2.ndx
. (myprogram
takes a string as input to the -o
switch and automatically appends the file extension .ndx
to that string.) So, I have written a bash shell script:
#!/bin/bash
make_ndx -o out1
make_ndx -o out2
I obtain two output files: out1.ndx
and out2.ndx
. But I would like to instead obtain out1.ndx
and out2.ndx
.
It seems like the
character in corresponds to a newline or return character (possibly \n
or \r
?), because when I copy and paste the file name to a text file (or to this post), out1.ndx
appears as
out1
.ndx
(Note that, for the purpose of this post, I am using another character (
) to represent the square symbol that I see in my SSH GUI, since when I copy the actual character from the SSH GUI to here, I simply obtain a newline character.)
How can I write my bash shell script so that the newline character does not appear in the filename of the first output file? The same problem occurs when I put an extra space between the calls to make_ndx
:
#!/bin/bash
make_ndx -o out1
make_ndx -o out2
Thanks for your time.