On 03/25/2016 02:03 PM, William Hermans wrote:
No chmod needed *IF* you precede the command with a dot slash "./". So when you run a regular Linux command do you have to type this dot slash ? No because chmod +x is run on the executable at some point . . .

So be nice to fellow group users who actually know what they're talking about, and have been on this list a lot longer than you.
Maybe we need to learn what ./ does... It has absolutely nothing to do with a files permissions or whether it's executable or not. It's use is regarding the lack of the current directory "." in one's PATH variable. Umask is (largely) what controls what permissions a file is created with.

mike@pride-n-joy:~/test.d$ ls -al
total 12
drwxr-xr-x  2 mike mike 4096 Mar 25 17:07 .
drwxr-xr-x 37 mike mike 4096 Mar 25 16:46 ..
-rw-r--r--  1 mike mike   78 Mar 25 16:47 hello.c
mike@pride-n-joy:~/test.d$ umask
0022
mike@pride-n-joy:~/test.d$ gcc -Wall -o hello hello.c
mike@pride-n-joy:~/test.d$ ls -l
total 12
-rwxr-xr-x 1 mike mike 6696 Mar 25 17:08 hello
-rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
mike@pride-n-joy:~/test.d$ hello
bash: hello: command not found
mike@pride-n-joy:~/test.d$ ./hello
Hello, world!
mike@pride-n-joy:~/test.d$ umask 0137
mike@pride-n-joy:~/test.d$ gcc -Wall -o hello hello.c
mike@pride-n-joy:~/test.d$ ls -l
total 12
-rw-r----- 1 mike mike 6696 Mar 25 17:09 hello
-rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
mike@pride-n-joy:~/test.d$ hello
bash: hello: command not found
mike@pride-n-joy:~/test.d$ ./hello
bash: ./hello: Permission denied
mike@pride-n-joy:~/test.d$ ls -l
total 12
-rw-r----- 1 mike mike 6696 Mar 25 17:09 hello
-rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
mike@pride-n-joy:~/test.d$ chmod 0750 hello
mike@pride-n-joy:~/test.d$ ls -l
total 12
-rwxr-x--- 1 mike mike 6696 Mar 25 17:09 hello
-rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
mike@pride-n-joy:~/test.d$ ./hello
Hello, world!
mike@pride-n-joy:~/test.d$ umask 022
mike@pride-n-joy:~/test.d$ umask
0022
mike@pride-n-joy:~/test.d$

Mike

On Fri, Mar 25, 2016 at 8:53 AM, Dieter Wirz <didi.w...@gmail.com <mailto:didi.w...@gmail.com>> wrote:

    On Fri, Mar 25, 2016 at 3:57 PM, Graham Haddock
    <gra...@flexradio.com <mailto:gra...@flexradio.com>> wrote:
    > Yes.
    > sudo chmod 755 myprogram
    > or
    > sudo chmod 755 myprogram.o
    >
    Graham, please do not tell fairy tails on this list!

    $ echo '#include <stdio.h>' > hello.c
    $ echo 'int main (void) {  printf ("Hello, world!\n");  return 0;
    }' >> hello.c
    $ cat hello.c
    #include <stdio.h>
    int main (void) {  printf ("Hello, world!\n");   return 0; }
    $ gcc -Wall -o hello hello.c
    $ ./hello
    Hello, world!
    $ ls -l
    total 12
    -rwxrwxr-x 1 dw dw 7332 Mar 25 16:32 hello
    -rw-rw-r-- 1 dw dw   80 Mar 25 16:31 hello.c
    $

    No chmod needed, no myprogram.o there, why the sudo????


--
For more options, visit http://beagleboard.org/discuss
--- You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to