Mailinglist Archive: opensuse (818 mails)

< Previous Next >
Re: [opensuse] different types of shell scripts
On Friday, September 23, 2011 16:02:28 Philipp Thomas wrote:

No. A normal user has '.' in his/her path by default, as you
can check by doing 'echo $PATH'. The user root doesn't have
'.' in PATH for the reasons I wrote.

i'll take issue with that last -- i was always told it is
dangerous and scary to put '.' in path, and have never seen a
distribution (in my limited experience) that puts it there by
default

i have several directories where i work on specific, isolated
projects -- my solution is to have two functions in my
~/.bashrc that add or remove $(pwd) to or from PATH -- i quote
the relevant section below:

————————————————————————————————————————
# dangerous path extension of %PWD
function dp () {
if [[ $PATH = $PWD:* ]]
then
echo "PATH already has $PWD"
else
export PATH=${PWD}:$PATH
export PS1='\w: '
fi
}
# remove dangerous path extension -- whew!
function rdp () {
export PATH=${PATH#$PWD:}
export PS1='\w> '
}
————————————————————————————————————————
they also tweak the PS1 so i can tell by looking if i've done
a 'dp' already, and to remind me it's done

sc

N�����r��y隊Z)z{.�ﮞ˛���m�)z{.��+�Z+i�b�*'jW(�f�vǦj)h����Ǿ��i�������
< Previous Next >
Follow Ups