-1

I want to execute below script

rm -rf /home/apps/temp
export DAA_HOME=/home/apps/Tools/3.6/eclipse
export BuildFile=/home/apps/Tools/Automated/BuildFile
alias Studio_Home=$DAA_HOME
rm -f Studio_Home/build.xml
cp $BuildFile/build.xml Studio_Home
cd Studio_Home
ant -f build.xml

And I'm getting following errors:

cp: cannot stat ‘/home/apps/Tools/Automated/BuildFile\r/build.xml’: No such file or directory
: No such file or directoryudio_Home

Can anyone please help??

muru
  • 197,895
  • 55
  • 485
  • 740
ranjeet
  • 161
  • 1
  • 2
  • 5

2 Answers2

2

Linux told you about your problem just fine, you just have to read:

/home/apps/Tools/Automated/BuildFile\r/build.xml: No such file or directory

There's a little \r which shouldn't be there. It seems like, in your script, the \r character was inserted at the end of the following line:

export BuildFile=/home/apps/Tools/Automated/BuildFile

Make sure your script file is saved in UTF-8 for UNIX. Lines ending with \r\n are typical to DOS systems like Windows. In gedit, this parameter can be set in the Save As window.

Gedit Save As

As a command line solution, here's a little sed replacement line:

sed "s/\r\n/\n/g" -i ./script.sh

You could also use the dos2unix program:

sudo apt-get install dos2unix
dos2unix ./script.sh
John WH Smith
  • 2,018
  • 14
  • 21
0

You have carriage return character in the path:

/home/apps/Tools/Automated/BuildFile\r/build.xml

It is invisible, that's why you didn't notice it. The simplest solution is to just re write this fragment by hand again in your editor and save the file.