[olug] conditional $PATH

Vincent Raffensberger Vincent.Raffensberger at dtn.com
Thu Aug 4 17:42:57 UTC 2005


Something like this would do the job in ~/.*profile:

pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}

if [ `id -g` = 1000 ]; then
        pathmunge /some/path
        pathmunge /some/other/path
fi 

-----Original Message-----
From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf Of
Timothy Larson
Sent: Thursday, August 04, 2005 12:06 PM
To: olug at olug.org
Subject: [olug] conditional $PATH

Hello again,

Is it possible to modify the $PATH of a user at login conditionally,
such as being based on the groups he is in?

Thanks,
Tim

_______________________________________________
OLUG mailing list
OLUG at olug.org
http://lists.olug.org/mailman/listinfo/olug



More information about the OLUG mailing list