Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to make a script executable ?


    How to make a script executable ?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,966
    - Set the x-bit for user/group/others (or a combination of them) with chmod
    - Make sure that the file is also readable via r-bit for user/group/others (or a combination of them) with chmod
    - The first line in the script should also be a valid shebang
    You must always face the curtain with a bow.

  3. #3
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,066
    Code:
    man chmod
    ........
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  4. $spacer_open
    $spacer_close
  5. #4
    I find that hard to understand.

    Quote Originally Posted by Irithori View Post
    - Set the x-bit for user/group/others (or a combination of them) with chmod

    - Make sure that the file is also readable via r-bit for user/group/others (or a combination of them) with chmod
    - The first line in the script should also be a valid shebang
    Did you mean this (user/group/others) ? 101 / 101 /101

  6. #5
    Quote Originally Posted by X-Man View Post
    How to make a script executable ?
    Invoking the script
    I refuse to let fear and fear of others rule my life. It puts my humanity at risk.
    Accepting Death is the only way to stay alive.

  7. #6
    Quote Originally Posted by X-Man View Post
    I find that hard to understand.



    Did you mean this (user/group/others) ? 101 / 101 /101
    are not bit are read from left to right ?

    101 = 1 x 2^0 + 0 x 2^1 + 1 x 2^2 = 1+0+4=5

    so code should be 555

    chmod 555 scriptname


    Am I right ?

  8. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,907
    The numbers are octal and represent the following values

    1 = Execute
    2 = Write
    4 = Read

    Typically, the owner has all permissions to a file so that would be 7, in this case it looks like you want to give everyone else read and execute which is 5. Remember these are octal numbers so should be prefixed with a 0. The command would be
    Code:
    chmod 0755 scriptname
    Should you be sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!


    The Fifth Continent

  9. #8
    You are confusing me. I have set the x-bit and r-bit for file permission. Now I want to convert them into numbers.

    How do I convert . should I read them left to right ? or right to left ?

    For example, say for user permission ...

    case 1: i have set 001 , whats the equivalent number ?

    case 2: i have set 100 , whats the equivalent number ?

    I want to know the maths here. How do I convert into numbers ?Need help at this part.

  10. #9
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,907
    It's basic binary but written as octal.
    Should you be sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!


    The Fifth Continent

  11. #10
    Still not clear . you did not answer the above. I am not yet clear. I posted two specific cases. Could you please answer those?

Posting Permissions

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