The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Run Bash Script /

Discussion in 'cPanel Developers' started by Spiral, Jun 24, 2010.

  1. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Remove the space in your shebang
     
  2. orbo

    orbo Registered

    Joined:
    Jun 24, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I want to run bash script in cpanel through putty is it possible ?

    Code:
    #!/bin/bash
    
    echo "hi i m newone here "
    filename : orbo

    Whenever i run this bash script from putty i got this error

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

    Plz tell me what to do and how

    Thanks
     
    #2 orbo, Jun 24, 2010
    Last edited: Jun 24, 2010
  3. orbo

    orbo Registered

    Joined:
    Jun 24, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Removed.. Still giving same error
     
    #3 orbo, Jun 24, 2010
    Last edited: Jun 24, 2010
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Looking closer at your error message, I would guess that you are not logged in as root and the account you are on is apparently in a jailshell which is an issue because that only calls jailed shells and not bash subshells else there would be no point in having a jailshell.

    The other thing is the carriage return (^M) which tells me that your script must of been written off the server and uploaded using the wrong file transfer mode (namely binary instead of ascii)

    The shebang does need to be '#!/bin/bash' for bash execution but as I said above probably can't run that because of the jailshell.

    You can do a "ls -la /bin/bash" and see what that says for reference

    Ignoring everything I said above, also don't forget that scripts have to have the executable permission bit set to be able to be executed directly
     
  5. orbo

    orbo Registered

    Joined:
    Jun 24, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    when i run command it says..

    -rwrx-rx-x 1 root root 801512 jan 21 2009 /bin/bash*
     
  6. orbo

    orbo Registered

    Joined:
    Jun 24, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Any Help ?
     
  7. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Orbo, from the shell run "dos2unix /path/to/script"

    The error:

    Code:
    -bash: ./orbo: /bin/bash^M: bad interpreter: No such file or directory
    indicates that this script contains windows-style newlines and not unix style new lines.

    (The ^M is the tell-tale sign)
     
Loading...

Share This Page