Fresh install of OS 13.2 cannot run scripts

Most bizarre thing I have ever seen in my life. I have a simple script that I wrote under openSUSE 13.1.
Same script on 13.2 fails with

bash: ./runterm3: /bin/sh^M: bad interpreter: No such file or directory

I wouldn’t even be fooling with 13.2 except 13.1 pukes all over UEFI on this Intel NUC I am working on.
Any clue as to what is going on with 13.2?

Fresh install, Sums verified, media verified, /home has ‘exec’ perms, user perms are fine, everything else
is default as installed vanilla 13.2. First thing I’ve done with this box is try this script. I even retransferred the script
to verify it wasn’t hosed.

I chose EXT4 for all filesystems.

That looks as if a file has been edited in Windows and has Windows line termination characters.

Without seeing the first lines of the script it is hard to say

the ^M indicates a carriage return which is is not legal in Linux shell scripts. Was this edited in Windows??

First line shbang should be

#!/bin/bash

Maybe be an oversight most openSUSE scripts would start with #!/bin/bash not #!/bin/sh

I have a sh shell here in 13.1 but it is not the bash shell not sure which shell it is.

I suspect the CR is the problem look in /bin and be sure you have a sh binary but I suspect that you do. remove the carriage return and it should work note if the first line has a CR then maybe the rest do. I believe there is a utility that will strip nasty Windows leavings ie CR but forget the name

Using the GNU file utility should identify that script.

file myscript

There is a dos2unix and unix2dos utility for that. (the name should redeem it self :slight_smile: )

Or you use some standard command line unix editor like ed,ex or even the stream editor sed.

Ok here some useful demo.

file myscript 
myscript: Bourne-Again shell script, ASCII text executable

You will have no problem running that script.

Now convert it to your favorite Windows os line ending.

unix2dos myscript
unix2dos: converting file myscript to DOS format ...

Now run that script.

./myscript 
bash: ./myscript: /bin/bash^M: bad interpreter: No such file or directory

checkout that myscript using the file utility.

file myscript
myscript: Bourne-Again shell script, ASCII text executable, with CRLF line terminators

Just do

dos2unix myscript 

to make it work on your openSUSE install (in any unix system that is).

The script has never been edited in windows. VI only.

Thanks for the tips. The dos2unix command fixed it but I have no idea why this was an issue to begin with.
The file was transferred using FTP in bi mode and I copied it twice to see if I could replicate the problem.
Even if the source file had CRLF’s in it, why would it run under 13.1 and not 13.2? Anyway, enough weirdness
for me. I’ll chalk it up to OS being on an even numbered release. Looks beautiful by the way, a bit ornery maybe.
At least UEFI seems to be sorted. Installs on an Intel NUC with w24 firmware if anyone is interested.