[oclug] set $PATH

Michael P. Soulier msoulier at digitaltorque.ca
Thu Jul 10 14:47:54 EDT 2003


On 10/07/03 Bruce Harding did speaketh:

> When setting $PATH can I use a wild card?
> 
> I.E.  export PATH=$PATH:/opt/OpenOffice.org*/program

    Hmm. You've actually come across some odd shell behaviour. 

[moulier at tigger msoulier]$ foo=$PATH
[msoulier at tigger msoulier]$ export foo=$foo:/usr/local/moz*
[msoulier at tigger msoulier]$ echo $foo
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/msoulier/bin:/sbin:/usr/sbin:/usr/local/moz*
[msoulier at tigger msoulier]$ which mozilla
[msoulier at tigger msoulier]$ type -all mozilla
bash: type: mozilla: not found

    So it's actually putting * into variable itself. 

    If I do this such that the variable contents are a single path,
wildcard expansion works. 

[msoulier at tigger msoulier]$ MOZ=/usr/local/moz*
[msoulier at tigger msoulier]$ echo $MOZ
/usr/local/mozilla
[msoulier at tigger msoulier]$ ls $MOZ
chrome             libldap50.so    libsoftokn3.chk         plugins
components         libmozjs.so     libsoftokn3.so          regchrome
defaults           libmozz.so      libssl3.so              registry
icons              libnspr4.so     libxlibrgb.so           regxpcom
install.log        libnss3.so      libxpcom_compat.so      res
libgkgfx.so        libnssckbi.so   libxpcom.so
run-mozilla.sh
libgtkembedmoz.so  libplc4.so      libxpistub.so           searchplugins
libgtksuperwin.so  libplds4.so     mozilla                 xpicleanup
libgtkxtbin.so     libprldap50.so  mozilla-bin
libjsj.so          libsmime3.so    mozilla-xremote-client

    But, the * is still in the variable. Hidden away.

[msoulier at tigger msoulier]$ foo=$PATH
[msoulier at tigger msoulier]$ export foo=$foo:$MOZ
[msoulier at tigger msoulier]$ echo $foo
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/msoulier/bin:/sbin:/usr/sbin:/usr/local/moz*

    That seems a little broken to me. I didn't know bash would do that. 

    To answer your question, it would appear not. You can probably
achieve the same result if you're more clever, and work a little harder.
Frankly, I think it should work, and I'm tempted to call this a bug.

    Mike

-- 
Michael P. Soulier <msoulier at digitaltorque.ca>, GnuPG pub key: 5BC8BE08
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix
IM: msoulier at jabber.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://tux.oclug.on.ca/pipermail/oclug/attachments/20030710/338e9e3b/attachment.bin


More information about the OCLUG mailing list