On Thu, Aug 18, 2011 at 12:32 AM, Alan D. Salewski <salew...@att.net> wrote: > 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: >> > 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 is no in-principle difference between using 'set' and using 'env'. It's just a different three letters here and there in your script. > There are at least three common scenarios to consider: > > 1. Inovking the Clojure-CLR from bash w/o setting or modifying > 'clojure.load.path'. Just run it. > 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. Use a script that wraps the invocation in a save and set, then a restore, of clojure.run.path; or spawn a subsidiary shell with its own copy of the environment with a short script that sets the environment variable and then runs Clojure-CLR, "popping" the environment changes on exit. > Scenario 3 cannot be addressed by 'env' because it requires manipulation > of the existing value of the variable. You aren't honestly claiming that there is no way to extract the value into a bash shell variable, are you? Not after you yourself posted this snippet earlier: $ /usr/bin/env -- ALJUNK_CRAP1=junk1 ALJUNK.CRAP2=junk2 /bin/bash -c env | grep ALJU ALJUNK.CRAP2=junk2 ALJUNK_CRAP1=junk1 So, env | grep clojure.class.path | sed <sed code to extract what's after the = goes here> | whatever and you can grab the existing value and compute something from it. Couldn't be simpler. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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