how to run a process from DOS within a cygwin .bat file

David Christensen dpchrist@holgerdanske.com
Sat Mar 1 06:57:00 GMT 2003


Tom Dager wrote:
> does someone knows how to launch a cygwin shell and further commands
> from DOS, e.g with a help of a .bat file.
> I had a look of cygwin.bat file but I do not know the right syntax to
> give the command to the bash shell

Some thoughts:

1.  Bash can be started either as a login shell or a non-login shell.

2.  Bash executes a larger or smaller set of scripts based upon the
    above.  These scripts need to be written in the Bash shell-scripting
    language.

3.  The choice of scripts is affected by environment variables (notably
    HOME) and/or by command-line arguments.

4.  There is a command line option "-c" that might be just what you're
    looking for:

      -c string If  the  -c option is present, then commands are
                read from string.  If there are arguments  after
                the  string, they are assigned to the positional
                parameters, starting with $0.

If you need more than a one-liner, it should be possible to write
(generate?) a Bash shell script and fix things so that Bash runs that
shell script when it starts (see the --noprofile
and --init-file/--rcfile command-line options).


> If the "manual" was a cohesive, comprehensive document ...

I have the following hypotheses about open-source software and
documentation:

1.  Writing code provides frequent mental stimulus and nearly immediate
    feedback (edit-compile-test-reward/punishment).  It's habit forming.
    The "pull of the summit" is very strong.

2.  Good programmers are rarely good technical writers;  I think its
    part aptitude and part choice/ practice.

3.  Writing code is sexy.  Writing good code makes you popular (even
    famous).  This attacts people towards the skill.

4.  Writing technical documentation is not sexy, and is viewed as an
    inferior role.  This drives people away from the skill.


In the technical book writing/ selling industry, there is positive
reinforcement for good technical writing.  I suggest that you buy the
following book.  I did, learned Bash from it, and find it to be an
invaluable reference.  Plus, I can curl up on the couch with it :-)

[1] Cameron Newham & Bill Rosenblatt, 1998, "Learning the Bash Shell",
    2 ed., O'Reilly & Associates, ISBN 1-56592-347-2.


> sick of seeing the RTFM response.

Agreed.  Good for you for having a measured response.  :-)


As for the RTFM'ers -- it is better to help people, than to attack or
bully them.  "Do unto others...".


HTH,

David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list