If the command name contains any '/' characters, use that as the path.Quote:>i`m implementing a shell, i`m having problems with finding the the exact
>path wich contains the commad<entered in the shell>.
>how can i use the access(Path,x_ok) method ???
>is there any other method i can use.
>programing in c
But why do you think you need to use access()? You can use execvp() and it
will automatically search the path for you. If the user doesn't have
execute permission then it will return an error.
Note that you have to check for this error even if access() says it's OK,
because the permissions can change after you call access().
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Here's the situation:
I'm a newbie logged in as root in KDE (I KNOW it's dangerous). When I type
'echo $PATH' I get '/sbin:/usr/sbin:/usr/bin:/usr/X11R6/bin'.
In /etc/profile I found a path statement but it looks like it's part of a
sub-script and it doesn't match this path (it includes games). I added a
'PATH=$PATH:/opt' and an 'export PATH'. I logged out and back in. It made
no difference to my path statement. I tried again with quote marks around
$PATH:/opt. No difference.
I've checked the bash profile and bashrc. I can't find where
'/sbin:/usr/sbin:/usr/bin:/usr/X11R6/bin' comes from. I'm running Mandrake.
Where is the path hidden? I've spent two days trying to find it on my own
following all the nice notes from LinuxNewbie. I yield. Help.