SUMMARY: Long path problem

From: Rasana P. Atreya (Rasana.Atreya@library.ucsf.edu)
Date: Thu Jan 25 1996 - 10:33:31 CST


After I posted my summary, I got another response from Pedro Melo which I
thought was worth posting.

Thanks, Pedro!

Rasana

My original problem: Path is VERY long (maybe a 100 or so) and causing
problems.

Solution thanks to Andrew Lamb <andrew@mis.mua.go.th> : Check each directory in
the path carefully. Do they all really exist? If one of them does not exist, it
would cause an error and the rest of the directories in the path instruction
would not be read. I suspect a missing or misplaced : in your path-setting
instruction in .profile or .cshrc

2) Even if the PATH env variable had /bin in it, the commands like 'date', 'pwd'
were not found.

Solution thanks to Andrew: Check that the user's group id is correct. Look in
the file /etc/passwd. The gid is stored in the 4th field (The fields are
seperated by : ) If his gid is incorrect he might not be able to access some
files that other users can access.

---------------------------------------------------------------------------
Pedro Melo (melo@rccn.net) says:

In the last thrilling episode, Rasana P. Atreya said:
>
> My original post, followed by the single response I received. My grateful
> thanks to Andrew Lamb <andrew@mis.mua.go.th>.
>
> Rasana

Hi!

Sorry. I have been away... I had the same problem and now my last line
in my .bashrc is:
export PATH=`path_sanitizer`

path_sanitizer is a script that checks each dir to see if they exist.

#!/usr/local/bin/perl
#
# Purpose:
# Remove not existing directories of a path enviroment variable.
#
# Version:
# 1.0
#
# Author:
# Pedro Melo, melo@rccn.net
#
# Usage:
# Typical usage is to put in the last line of your .bashrc
# export PATH=`path_sanitizer`
#
# Improvements:
# As you migth have notice, this only works in bash and sh (at least, I only
# tested with this two...). Should work in any shell whose PATH is separated
# by :.
# Also: remove duplicates... Will do it sometime... :)
#
# History:
#
# 1.0: First cut...
# Tue Jun 13 19:15:23 MET DST 1995
#
# Plea:
# If you improve this script, send me a copy... :)
#
 
print join(":", grep {$values{$_} || ! -d $_?0:($values{$_}=1);} split(/:/, $ENV{"PATH"}));

- - --



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:52 CDT