
02-11-2009
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
|
|
Quote:
Originally Posted by amio
Hi all,
Am creating files and doing copy,compare and deletion.
As i do not want to mention the filepath everywhere, i store the filepaths in variables.
|
Please put code inside [code] tags.
Quote:
Code:
FILENAME="/home/test/create/Myfile.txt"
WR_PATH="/home/test/wrie/writefile.txt"
RD_PATH="/home/test/myread/readfile.txt"
echo "This is my new file" >> $FILENAME
cp $FILENAME $WR_PATH
cp $WR_PATH $RD_PATH
cmp $FILENAME $RD_PATH
My problem is,
The files are created inside the folders with '\r' or '\r\r' characters at the end of the filename and hence cp failed with "No such file or directory"
|
Did you write the script using a Windows editor? If so, you must remove the carriage returns before you execute the script on a real computer.
|