I wanted to execute a shell script:
-rwxr-x--x 1 root root 17234 Jun 6 18:31 create_mgw_3shelf_6xIPNI1P.sh
I tried to do a standard procedure, but I got this error:
./create_mgw_3shelf_6xIPNI1P.sh
localhost 389 -l /opt/fews/sessions/AMGWM19/log/2013-06-06-143637_CLA-0
DEBUG cd/etc/opt/ldapfiles/ldif_in ;
./create_mgw_3shelf_6xIPNI1P.sh
localhost 389 -l /opt/fews/sessions/AMGWM19/log/2013-06-06-143637_CLA-0
**ERROR sh: ./create_mgw_3shelf_6xIPNI1P.sh: /bin/bash^M: bad interpreter: No such file or directory**
What does it mean? I was doing this as the root
user under the root
group.
Does it mean that the file does not have the correct permission for the root
user?
dos2unix
program. – argentpepper Jun 06 '13 at 22:56\n
because it's Unix. The script was maybe from an earlier Mac OS version? You could runsed -i -e 's/\r$/\n/' script.sh
in that case. – wjandrea Dec 21 '16 at 04:49perl -i -pe 's/\r$//' …
. On systems that don't recognize\r
to mean a carriage return, the command I posted might error out of might remover
or\r
(the two-character sequence backslash, lowercase R) at the end of lines. Recent macOS (at least Big Sur) does interpret\r
as CR though. – Gilles 'SO- stop being evil' Dec 19 '21 at 11:55