Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not foundsh: 2: error comes while exectutin a shell command?

Tags:

shell

when i run sh backuptest.sh, following error comes .So is it issue with the code or my shell

result :
: not foundsh: 2: backuptest.sh:
: not foundsh: 4: backuptest.sh:
: not foundsh: 6: backuptest.sh:
: not foundsh: 7: backuptest.sh:



content of backuptest.sh
#!/bin/sh -e
location=`date +%Y%m%d`.sql
mysqldump -u root -proot spider_db > $location
like image 670
user2782906 Avatar asked Oct 31 '14 09:10

user2782906


People also ask

Which is not available in shell script?

Which of the following loops is not available in shell? Explanation: The foreach loop is not available in shell. 2. The _______ loop executes the given commands until the given condition remains true.

How do I run a Jenkins shell script in Windows?

Create a freestyle project on Jenkins. Use the advanced configuration page to use custom workspace. Add the path to your shell script. Under the build step, select "execute shell"

What is$'\ r?

$'\r' is a representation of the carriage return character (CR) that is part of traditional DOS and Windows line endings (CR LF), but which is absent in traditional Unix-style line endings (LF).


1 Answers

remove #!/bin/sh -e and try

dos2unix backuptest.sh

then execute again with

./backuptest.sh
like image 117
Jss Anthony Avatar answered Sep 21 '22 07:09

Jss Anthony