I was trying to move a file name containing a particular string to another directory in a shell script, but during the filename expansion I am getting \r in the file
Local_Input_Landing_Dir=`grep Local_Input_Landing_Dir $CFILE | awk -F= ' {print $2} '`
src_dir="$Local_Input_Landing_Dir"/*_vendor.csv
echo 'before' $src_dir
The o/p of the above echo is being spliing over to next line
before /stage/Scripts/ecommerce/vendor/Data_split_vendor
/*vendor.csv
When I try using the move command, I get \r while expansion
mv $src_dir $Local_Input_Landing_Dir/current_date_dir/
mv: cannot stat `/stage/Scripts/ecommerce/vendor/Data_split_vendor\r/*_vendor.csv': No such file or directory
If you are developing on Windows and use your script on a Unix machine you should convert your files (the new line character is \r\n
on windows and \n
on unix)
Use the command
dos2unix your_file