• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

More tux questions.

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:
 
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.
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.
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:
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:
echo $PATH

Of the directories that are listed, do any of them contain copies of the files you're referring to? Try this:

Code:
which -a one_of_your_files

Is there more than one location listed?
 
Upvote 0
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:
echo $PATH

Of the directories that are listed, do any of them contain copies of the files you're referring to? Try this:

Code:
which -a one_of_your_files

Is there more than one location listed?

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.
 
Upvote 0
I copied the files by click and dragging the directory in Nautilus.
For future reference, use cp at a command line along with its -p (preserve) flag to save all files' original attributes.
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.
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:
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?
 
Upvote 0
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.
 
Upvote 0
Correct, they are in ~/shells.
And where are you when you're invoking them? How are you invoking them?
the output of $PATH is:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
So they're not in your path. When you invoke them, are you preceding them with something?
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
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.
ps. dave1.sh has different permissions because I intentionally changed it just to see if there was any difference when executing. There isn't.
And now we know why!
Thanks for all the help with my n00b questions.
You're welcome. :)
 
  • Like
Reactions: baillou2
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones