1. Download our Official Android App: Forums for Android!

More tux questions.

Discussion in 'Computers' started by baillou2, Mar 5, 2011.

  1. baillou2

    baillou2 Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    63
    Posts:
    240
    Joined:
    Sep 28, 2010

    Sep 28, 2010
    240
    43
    63
    my job sucks....
    The Aloha State on a smallish island...
    I noticed after moving all my saved shell scripts from my external HD back onto my freshly reloaded laptop that they no longer had the same permissions as they did before.
    This in itself isn't too weird I guess, but the strange part is that I no longer need to make new scripts executable i.e. (chmod +x ...). Instead the scripts run just fine without the usual permissions. None of them have executable permission. Specifically they are all '-rw-r--r--'.

    So what gives?:thinking:
     

    Advertisement

  2. MoodyBlues

    MoodyBlues - Crazy peacock person -
    VIP Member
    Rank:
     #56
    Points:
    453
    Posts:
    3,433
    Joined:
    Jan 27, 2011

    Jan 27, 2011
    3,433
    1,750
    453
    Formerly UNIX/Linux programmer/sysadmin, now disab
    /home/LosAngeles
    I don't know what method you used to move the files--I'm guessing GUI--but you could have saved all their original attributes (time stamps, ownership, permissions, etc.), at a command line by copying with the preserve flag.
    Without having a look at your file system I can't say anything for sure--except that in 25+ years I have yet to see *nix files be executable that don't have their permissions set that way. :eek: So my *GUESS* is that you're working with more than one copy of the files. Check your path to see what other directories are in it:

    Code (Text):
    1. echo $PATH
    Of the directories that are listed, do any of them contain copies of the files you're referring to? Try this:

    Code (Text):
    1. which -a one_of_your_files
    Is there more than one location listed?
     
  3. baillou2

    baillou2 Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    63
    Posts:
    240
    Joined:
    Sep 28, 2010

    Sep 28, 2010
    240
    43
    63
    my job sucks....
    The Aloha State on a smallish island...
    I copied the files by click and dragging the directory in Nautilus.

    As far as other copies, that can't be it because I've also created a bunch of new scripts (with the same -rw-r--r-- permissions) in only my little ~/shells directory, and they all execute just fine.
    I'm freekin' out man.....:eek: ...not really, but I'm annoyed and confused.
     
  4. MoodyBlues

    MoodyBlues - Crazy peacock person -
    VIP Member
    Rank:
     #56
    Points:
    453
    Posts:
    3,433
    Joined:
    Jan 27, 2011

    Jan 27, 2011
    3,433
    1,750
    453
    Formerly UNIX/Linux programmer/sysadmin, now disab
    /home/LosAngeles
    For future reference, use cp at a command line along with its -p (preserve) flag to save all files' original attributes.
    There *IS* an explanation...we just don't know what it is yet! :eek:

    When they're executing, WHERE are you? I mean, are you at a command line in the directory holding the scripts?

    Please post the output of the following from within the directory holding the scripts:
    Code (Text):
    1. pwd ; ls -l
    Also, please post the output of echo $PATH.

    From your comment above I'm assuming these scripts are stored in ~/shells, correct?
     
  5. baillou2

    baillou2 Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    63
    Posts:
    240
    Joined:
    Sep 28, 2010

    Sep 28, 2010
    240
    43
    63
    my job sucks....
    The Aloha State on a smallish island...
    Correct, they are in ~/shells.

    the output of ls-l is:

    total 96
    drwx------ 2 david david 4096 2011-03-05 16:17 ./
    drwxr-xr-x 39 david david 4096 2011-03-05 18:41 ../
    -rw-r--r-- 1 david david 171 2011-02-15 01:48 byes
    -rw-r--r-- 1 david david 79 2011-03-05 06:03 dave
    -rwxr-xr-x 1 david david 21 2011-03-05 05:03 dave1.sh*
    -rw-r--r-- 1 david david 108 2011-03-05 16:17 foob
    -rw-r--r-- 1 david david 123 2011-02-15 18:28 ifthen
    -rw-r--r-- 1 david david 55 2011-02-16 01:34 loops
    -rw-r--r-- 1 david david 94 2011-03-05 03:34 loops4
    -rw-r--r-- 1 david david 450 2011-03-05 04:49 magic
    -rw-r--r-- 1 david david 77 2011-02-20 05:41 myvar
    -rw-r--r-- 1 david david 72 2011-03-05 03:00 myvar2
    -rw-r--r-- 1 david david 194 2011-03-05 05:52 sayH
    -rw-r--r-- 1 david david 12288 2011-02-15 18:59 .swp
    -rw-r--r-- 1 david david 38 2011-02-15 20:29 test1.sh
    -rw-r--r-- 1 david david 147 2011-03-05 02:56 test3
    -rw-r--r-- 1 david david 147 2011-02-15 19:05 test3.sh
    -rw-r--r-- 1 david david 344 2011-02-15 21:06 test4.sh
    -rw-r--r-- 1 david david 152 2011-03-05 05:45 touch
    -rw-r--r-- 1 david david 58 2011-02-15 20:33 update.sh
    -rw-r--r-- 1 david david 127 2011-02-15 18:11 while
    -rw-r--r-- 1 david david 175 2011-03-05 04:06 while2


    the output of $PATH is:
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

    Thanks for all the help with my n00b questions.

    ps. dave1.sh has different permissions because I intentionally changed it just to see if there was any difference when executing. There isn't.
     
  6. MoodyBlues

    MoodyBlues - Crazy peacock person -
    VIP Member
    Rank:
     #56
    Points:
    453
    Posts:
    3,433
    Joined:
    Jan 27, 2011

    Jan 27, 2011
    3,433
    1,750
    453
    Formerly UNIX/Linux programmer/sysadmin, now disab
    /home/LosAngeles
    And where are you when you're invoking them? How are you invoking them?
    So they're not in your path. When you invoke them, are you preceding them with something?
    Okay, I think I just had my lightbulb moment: Are you invoking these by preceding them with sh? If so, the mystery's solved, as a file doesn't need to be executable to be run with sh. I--being the old...ancient...really old...*nix person that I am just ASSUMED (and you know what that implies! :D) that you were invoking them by simply using their names.
    And now we know why!
    You're welcome. :)
     
    baillou2 likes this.
  7. baillou2

    baillou2 Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    63
    Posts:
    240
    Joined:
    Sep 28, 2010

    Sep 28, 2010
    240
    43
    63
    my job sucks....
    The Aloha State on a smallish island...
    Actually I invoke them from within the directory with ". ./shellscript".
    But I can do it with sh as well.
     

Share This Page

Loading...