I have a file abc.out and I need to read it and export the content to the named pipe. My shell script as below:
#!/bin/ksh -x
cd /home/robert/
if [[ -s abc.out ]]; then
sleep 2
for i in `cat abc.out`
do
mv -f $i ./abc_archive/x$i
print `pwd`/abc_archive/x$i > /home/robert/pipe_abc
sleep 1
done
fi
The content of abc.out file as below:
2001010000
2001010001
2001010002
But when I run the script with the command sh abc.spt
, error prompted as below:
mv: cannot stat ‘2001010000\r’: No such file or directory
How can I fix this issue, many thanks!