• Post Reply Bookmark Topic Watch Topic
  • New Topic

set environment variable to content of text file...  RSS feed

 
Matt Horton
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • 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 ]
 
Tim Holloway
Saloon Keeper
Posts: 18797
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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...
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Stefan! (and sorry for the delayed response; I dropped off of the planet ).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!