• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

set environment variable to content of text file...

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How do I do something ala:

set CLASSPATH=`cat classpath1.txt'

or
set CLASSPATH = (what would go here??) | cat classpath1.txt

I usually just source a file w/ the command built-in, but I asked myself this, and now I have to know.
[ May 02, 2007: Message edited by: Matt Horton ]
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your first example works for me, although 'export' would be more appropriate than 'SET', I think.

The second one probably does nothing, since you're attempting to pipe output of the SET command (which probably wouldn't have output) into a program that's already been told that it is supposed to get input from a file.

I'm not sure if there's a Unix shell with a 'SET' command, though. SET is a Windows command.
 
Matt Horton
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

a set command shows up for me in bash (mac os x 10.4 bastardized unix). But isn't there also one in csh? Either way, I wrote that second command in a backwards way...

Thanks for the heads up about export, it works for me too...
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well - the first command won't work, because of missing closing backtick:

instead of

On bash, you may use

which is better readable, writable and nestable.

SET doesn't work for me, but

does.

works too, but is sitting there, waiting for an Ctrl-d.
 
Matt Horton
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Stefan! (and sorry for the delayed response; I dropped off of the planet ).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic