Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
How to make a script executable ?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2005
    Posts
    27

    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,390
    - 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,023
    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. #4
    Just Joined!
    Join Date
    Sep 2005
    Posts
    27
    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

  5. #5
    Linux Guru rokytnji's Avatar
    Join Date
    Jul 2008
    Location
    Desert
    Posts
    4,087
    Quote Originally Posted by X-Man View Post
    How to make a script executable ?
    Invoking the script
    Linux Registered User # 475019
    Lead,Follow, or get the heck out of the way. I Have a Masters in Raising Hell
    Tech Books
    Free Linux Books
    Newbie Guide
    Courses at Home

  6. #6
    Just Joined!
    Join Date
    Sep 2005
    Posts
    27
    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 ?

  7. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,561
    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
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  8. #8
    Just Joined!
    Join Date
    Sep 2005
    Posts
    27
    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.

  9. #9
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,561
    It's basic binary but written as octal.
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  10. #10
    Just Joined!
    Join Date
    Sep 2005
    Posts
    27
    Still not clear . you did not answer the above. I am not yet clear. I posted two specific cases. Could you please answer those?

Page 1 of 2 1 2 LastLast

Posting Permissions

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