This is the mail archive of the cygwin 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: Getting started with bash

Mark J. Reed wrote on Monday, April 07, 2008 8:21 AM:

> You hit the nail on the head with the environment vars question. 
> Bash tries to do the minimum amount of work possible when invoked
> non-interactively, on the assumption - almost universally true in
> *NIX - that it is being invoked by a process (usually another shell)
> that has its environment all set up already.  So when that's not the
> case, you need to tell bash so by adding the "-l" or "--login"
> option, so it will go out and read login-oriented startup files
> ([bash_]profile)  to set up its own environment.      
> On 4/7/08, Joel M. Baldwin <> wrote:
>> --On Monday, April 07, 2008 10:25 AM +0200 Michael Holm
>> <> wrote:
>>> Hi,
>>> I have read a lot of documents, but i really cant get this issue
>>> solved :( All i want is to be able to execute bash scripts from a
>>> windows desktop.. what i do now is..
>>> a batch script:
>>> c:\cygwin\bin\bash c:\cygwin\
>>> this is my bash script.
>>> ls -l
>>> but i get the following output:
>>> command not found.
>>> i hope that someone can give me a hit... all i have done is:
>>> install cygwin, made my batch script.. and made my bash script.. do
>>> i need to set any environment vars or something?
>>> mvh
>>> Michael Holm
>> Add the -l option to bash.
>> i.e. "man bash" for an explanation
>> This makes it a login shell which must cause the PATH variable to be
>> set. 

You might also want to us "-c", e.g.,
	bash -lc script
if you want bash to close automatically at the end of the script.

Also, I'm not sure that giving DOS/Windows paths will work, nor may paths using backslashes ("\"), which in unix-land are escape characters, for path separators (forward slashes ("/")).  So be sure that is in a directory that is in your path, or figure out what the full unix/cygwin path to it is, e.g.,
	bash -l /cygdrive/c/cygwin/
	bash -l /

- Barry

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