Results 1 to 7 of 7

Thread: Fresh install of OS 13.2 cannot run scripts

  1. #1
    Join Date
    Jun 2008
    Location
    Delta Quadrant
    Posts
    1,441

    Default 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.

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,354
    Blog Entries
    3

    Default Re: Fresh install of OS 13.2 cannot run scripts

    Quote Originally Posted by GofBorg View Post
    bash: ./runterm3: /bin/sh^M: bad interpreter: No such file or directory
    That looks as if a file has been edited in Windows and has Windows line termination characters.
    openSUSE Leap 15.1; KDE Plasma 5;

  3. #3
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,649

    Default Re: Fresh install of OS 13.2 cannot run scripts

    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

  4. #4

    Default Re: Fresh install of OS 13.2 cannot run scripts

    Using the GNU file utility should identify that script.

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

    Or you use some standard command line unix editor like ed,ex or even the stream editor sed.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  5. #5

    Default Re: Fresh install of OS 13.2 cannot run scripts

    Ok here some useful demo.

    Code:
    file myscript
    Code:
    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.

    Code:
    unix2dos myscript
    Code:
    unix2dos: converting file myscript to DOS format ...
    Now run that script.
    Code:
    ./myscript
    Code:
    bash: ./myscript: /bin/bash^M: bad interpreter: No such file or directory
    checkout that myscript using the file utility.

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

    Code:
    dos2unix myscript
    to make it work on your openSUSE install (in any unix system that is).
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  6. #6
    Join Date
    Jun 2008
    Location
    Delta Quadrant
    Posts
    1,441

    Default Re: Fresh install of OS 13.2 cannot run scripts

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

  7. #7
    Join Date
    Jun 2008
    Location
    Delta Quadrant
    Posts
    1,441

    Default Re: Fresh install of OS 13.2 cannot run scripts

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •