This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: beginner question: using 'set VAR=...'


Shell scripts run in a subshell, which has its own environment.  If you
want to modify the current environment, run the script in the current
shell (using the "source" command in most shells).  Make sure the script
is written for the same shell as the one you're running (e.g., don't try
sourcing csh scripts under bash).

If you simply want the variables to be visible in the commands that are
invoked from the subshell, use the "export" command in bash (or put "set
-a" in your /etc/profile).  For more info, "info bash".
	Igor

On Tue, 22 Apr 2003, tek1 wrote:

> Thank you for your reply.
>
> I have also tried the shell scripts, but the variables are not
> available/exposed after the script has executed...
>
> At 11:02 03/04/22 -0400, you wrote:
> >On Tue, 22 Apr 2003, tek1 wrote:
> >
> > > Using Cygwin, I'm trying to run some .bat scripts that contain 'set
> > > VAR=....' statements.  However, after the script is run, those variables
> > > defined by the 'set' statement are not recognized (as environment
> > > variables).  These are variables that are to exist temporarily (i.e. during
> > > the session or time that the Cygwin window is open), so I do not want to
> > > put them in CYGHOME/cygwin.bat.
> > >
> > > Any advice?
> > > Thank you.
> >
> >FYI, .bat files aren't run by Cygwin.  Running a .bat file invokes the
> >Windows command processor, which interprets the .bat file.
> >
> >Any particular reason you're not using shell scripts?
> >         Igor

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha at cs dot nyu dot edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson dot ibm dot com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]