On Tuesday 21 June 2011 20:36:25 Marc Espie wrote:
> > I use this in my .profile files, maybe it'll be useful to others too:
> >
> > local _test=$(grep "^installpath =" /etc/pkg.conf | cut -f 2 -d '=' | sed
> > -e 's/ //') test -n _test && export PKG_PATH=$_test
>
> Well, if you're going to use sed anyways:
>
> sed -ne '/^installpath = */s///p' /etc/pkg.conf

Thanks for the shorter version. I used the syntax from Alexander's mail that 
is more familiar to me.

Someone else noticed that the test-part was not correct. Here's a better 
version. It works in ksh and zsh:

# tail -n 3 /etc/profile
_test=$(sed -ne 's/^installpath = *//p' /etc/pkg.conf)
test -n "$_test" && export PKG_PATH=$_test
unset _test

-- 
Antti Harri

Reply via email to