Troubleshooting
Problem
Using the RegenerateEntriesInDE.sh failed with this error: -bash: ./RegenerateEntriesInDE.sh: /bin/sh^M: bad interpreter: No such file or directory
Symptom
RegenerateEntriesInDE.sh fails:
[netcool]]$ ./RegenerateEntriesInDE.sh <TIP_HOME>/_uninst/TIPInstall22013
-bash: ./RegenerateEntriesInDE.sh: /bin/sh^M: bad interpreter: No such file or directory
Cause
The script indicates that it must be executed by a shell located at /bin/bash^M. There is no such file: it's called /bin/bash.
The ^M is a carriage return character. Linux uses the line feed characters to mark the end of a line, The RegenerateEntriesInDE.sh file has windows line endings, which is confusing Linux.
This can happen when unzipping a zip file that has been created in a windows environment.
Environment
Linux OS, Deployment Engine 1.4.0.x
Diagnosing The Problem
Unzip the RegenerateEntriesInDE 2.0.zip file, chmod u+x RegenerateEntriesInDE.sh, then execute the RegenerateEntriesInDE.sh command, if it fails with this error: "/bin/sh^M: bad interpreter: No such file or directory"
Use the Octal dump command to check the characters:
$ od -c RegenerateEntriesInDE,sh
0000000 # ! / b i n / s h \r \n \r \n ( carriage return character which is incorrect for Linux environment. )
Resolving The Problem
If the end of line characters are determined to be carriage return characters, use this SED command to clean the file:
$ sed -i -e 's/\r$//' RegenerateEntriesInDE,sh
Then use the od command to confirm the change, the end of line characters should look like this after the sed command:
$ od -c RegenerateEntriesInDE,sh
0000000 # ! / b i n / s h \n \n ( line feed character )
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
swg21972598