[lug] Idea for a new tutorial....maybe???

Tkil tkil at scrye.com
Sat Apr 8 20:01:33 MDT 2000

>>>>> "Hugh" == Hugh Brown <hugh at math.byu.edu> writes:

Hugh> So on my machine my path is 

Hugh> /bin:/usr/local/bin:/etc:/usr/sbin:/sbin:/usr/local/sbin:\
Hugh> /usr/local/java/bin:/usr/etc:/etc:/usr/bin:/usr/bin/X11:\
Hugh> /usr/local/X11R6/bin:/usr/lib/X11/fonts:/usr/local/X11R6/include:\
Hugh> /usr/local/rvplayer5.0:/opt/teTeX/bin:/usr/local/share/afterstep:\
Hugh> /home/hugh/bin:/home/hugh/:/home/hugh/perl

Hugh> and my shell finds ls in /bin and runs it.  If I had written a
Hugh> program and named it ls and then put it in /home/hugh/bin and
Hugh> put /home/hugh/bin ahead of /bin in the path then my version of
Hugh> ls would be run instead of the system ls.

um, i don't think so.  at least bash scans PATH in left-to-right
order.  time to experiment!  yes, it seems to be left-to-right:

| $ export
| PATH=/home/tkil/test/d1:/home/tkil/test/d2/:home/tkil/test/d3
| $ where_am_i
| findbin reports: "/home/tkil/test/d1"
| $ export
| PATH=/home/tkil/test/d3:/home/tkil/test/d2/:home/tkil/test/d1
| $ hash -r
| $ where_am_i
| findbin reports: "/home/tkil/test/d3"

where "where_am_i" is a simple perl script:

| #!/usr/bin/perl -w
| use FindBin qw($Bin);
| print "findbin reports: \"$Bin\"\n";
| exit 0;

of course, i could have done that with just a simple "type" statement,
i suppose.  oh well, when i have a sledgehammer...

Hugh> As far as the practice program for your fiancee, edit her .cshrc
Hugh> or .tcshrc and append the path to the executable program to the
Hugh> existing path variable.  If it isn't in there, add a line that
Hugh> says set PATH=($PATH /new/path/to/practiceprogram)

wow, csh syntax is even uglier than i remembered.  i thought you had
to use the lower-case "path" thing when you used the parenthesis
notation?  something like this:

| set path=($path /new/path)

but i don't get along with csh, so if your way works, so be it!  :)


More information about the LUG mailing list