SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i was just fooled by something and I need your help to understand. I have a script that runs AlienBob's script to build an install iso. My script is in /usr/local/bin. I wasn't sure of its location so I 'cd' to the directory, ran 'ls' then ran the script. Problem is that I didn't precede the script with ./ but it ran any way. My experience tells me it shouldn't have worked.
Only thing i can guess is the /usr/local/bin is in my path. Does that change the requirement for the './'
It work because it's in your $PATH and has the executable bit set.
'which foo.sh' should output the script if it's in your path.
The ./ only executes the script in 'pwd' and doesn't execute the script you got in your $PATH.
EDIT: i see i was to slow as well but i'm a slow typer
Last edited by Nille_kungen; 07-19-2009 at 07:14 PM.
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Rep:
Have a look at the bash startup file /etc/profile - this is an excerpt :
Code:
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
So the current working directory gets added to the path for non root users. The file also sets the default system path here :
Code:
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
so /usr/local/bin is set in your path anyway. If you want to check this just run :
Code:
echo $PATH
to see what the path is set too. As has been said - files in the search path will execute, (if executable), without giving their directory to the command line.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.