On Wed, Aug 17, 2011 at 01:47:53PM -0400, Ken Wesson spake thus:
> On Wed, Aug 17, 2011 at 9:48 AM, Alan D. Salewski <salew...@att.net> wrote:
> >    $ /usr/bin/env -- ALJUNK_CRAP1=junk1 ALJUNK.CRAP2=junk2 /bin/bash -c env 
> > | grep ALJU
> >    ALJUNK.CRAP2=junk2
> >    ALJUNK_CRAP1=junk1
> >
> > You approached the question from the perspective of one just wanting to
> > launch Clojure-CLR with a 'clojure.class.path' value inherited from the
> > host OS, however that can be made to work.
> >
> > I approached the question from the perspective of one wanting to invoke
> > Clojure-CLR with the ability to manipulate the value of
> > 'clojure.class.path' "on-the-fly" in a way that is common and natural
> > for *nix folks.
> 
> And with 'env' it clearly is possible to manipulate the value on the
> fly, as Stephen pointed out three hours before your post and as you
> yourself have demonstrated.

Aside from the matter that using 'env' is clunky for common command line
usage, it is /not/ possible manipulate the value on the fly, generally.
There are at least three common scenarios to consider:

    1. Inovking the Clojure-CLR from bash w/o setting or modifying
       'clojure.load.path'.

    2. Invoking the Clojure-CLR from bash, supplying an explicit value
       for 'clojure.run.path' not based on the existing value, if any.

    3. Invoking the Clojure-CLR from bash, augmenting the existing value
       of 'clojure.run.path' with an explicit value.


Scenario 1 is the simplest case. As we've said, it can be addressed by
using a new enough version of bash; it will "just work", and there is no
need to use 'env' or anything else. (This does not address the issue for
users who use shells other than bash on cygwin or its ilk, but let's
ignore that for now.)

Scenario 2 can be addressed by 'env' (as we've seen) or similar.

Scenario 3 cannot be addressed by 'env' because it requires manipulation
of the existing value of the variable. Consider:

    $ unset PATH
    /usr/bin/env -- "PATH=/my/new/value${PATH+:}${PATH}" /bin/bash -c 
/usr/bin/env | /usr/bin/grep '^PATH='
    /my/new/value

    $ export PATH=/usr/bin
    /usr/bin/env -- "PATH=/my/new/value${PATH+:}${PATH}" /bin/bash -c 
/usr/bin/env | /usr/bin/grep '^PATH='
    PATH=/my/new/value:/usr/bin

Compare that with:

    $ /usr/bin/env -- "clojure.load.path=/the/os/default" /bin/bash
    $ /usr/bin/env | grep clojure
    clojure.load.path=/the/os/default
    $ /usr/bin/env -- 
"clojure.load.path=/my/new/value${clojure.load.path+:}${clojure.load.path}" 
/bin/bash
    bash: 
clojure.load.path=/my/new/value${clojure.load.path+:}${clojure.load.path}: bad 
substitution   


Can that be addressed by supplying a special purpose tool to accomplish
the task? Sure.

Is there a good reason to require such a thing? Maybe; I don't pretend to
know.

 
> The OP's problem has been solved;

...as he pointed out, for a limited definition of "solved".


> let's move on.

Agreed.

Respectfully,
-Al


-- 
-----------------------------------------------------------------
a l a n   d.   s a l e w s k i                   salew...@att.net
1024D/FA2C3588 EDFA 195F EDF1 0933 1002  6396 7C92 5CB3 FA2C 3588
-----------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to