[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: paths(newbie)

On Thu, Aug 02, 2001 at 03:11:28AM -0400, R1nso13@aol.com wrote:
> a couple of basic questions:
> 1. if a user's path isn't specified in .bashrc, what path is used, and what 
> file is it found in?

here's how to find out:

1) make sure your ~/.bash* files don't set yuor $PATH (comment
out any lines that do)

2) log in

your $PATH is set to SOMETHING:

3) echo $PATH

find out where:

4) grep -r "$PATH" /etc

but this might not work if $PATH is set and then appended (or
prepended) to...

> 2. are paths recursive? (i'm thinking not on this one, or else why not just 
> set the path to the root directory?)

the $PATH environment variable tells your shell where to go
looking for an executable program when you don't specify a full
path on the command line:

	$ ls
	$ perl
	$ ifconfig

that sure beats typing

	$ /bin/ls
	$ /usr/bin/perl
	$ /sbin/ifconfig

doesn't it? and it works when your $PATH includes


that last one (/sbin) is system binaries mostly useful to the
system adminostrator, so normal users won't have /sbin in their
$PATH list, and "ifconfig" won't be found by the shell.

if you set $PATH to '' (empty) then you'll have to include the
full path for EVERY non-builtin command there is. (ick!)

so no, it's not recursive -- 

1) that's very taxing to search all subdirectories (to see the
effects on your system, try "find / -name something -print" and
listen to the disk crunch away)

2) there's no prioritization where /sub3/subsubX would be searched
before /sub1/dir5 if you wanted it to be. with $PATH you can specify
~/bin first to have your own home-grown programs 'override' the
system utilities, at least for your user login

3) who wants to wait for "find / ..." to finish?

of course, you could write your own shell that DOES recurse...
this is linux, after all.

DEBIAN NEWBIE TIP #60 from Vineet Kumar <debian-user@virtual.doorstop.net>
Been hoping to find A FEATURE-PACKED MUTT CONFIG FILE? Check
out the ones at Sven Guckes' site:
There's also some great vimrc ideas there, too.

Also see http://newbieDoc.sourceForge.net/ ...

Reply to: