public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Trick cmd.exe of Windows XP to run cygwin Batch Script.
@ 2009-01-04 10:37 Hongyi Zhao
  2009-01-04 11:07 ` Frank Fesevur
  2009-01-04 17:10 ` Spiro Trikaliotis
  0 siblings, 2 replies; 12+ messages in thread
From: Hongyi Zhao @ 2009-01-04 10:37 UTC (permalink / raw)
  To: cygwin

Hi all,

I've some cygwin/bash scripts and I want to invoke them without log
into the Cygwin's bash terminal.  Is this possible?

Regards,

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-04 10:37 Trick cmd.exe of Windows XP to run cygwin Batch Script Hongyi Zhao
@ 2009-01-04 11:07 ` Frank Fesevur
  2009-01-04 13:09   ` Jeenu V
  2009-01-05 11:27   ` Hongyi Zhao
  2009-01-04 17:10 ` Spiro Trikaliotis
  1 sibling, 2 replies; 12+ messages in thread
From: Frank Fesevur @ 2009-01-04 11:07 UTC (permalink / raw)
  To: cygwin

Hongyi Zhao wrote:
> I've some cygwin/bash scripts and I want to invoke them without log
> into the Cygwin's bash terminal.  Is this possible?

I have written a small utility named 'weft' that can set a file
association to start .sh-files with a cygwin bash by double clicking
it in the Explorer. I don't have it here anymore, so I have to dig
that up in my archives if you interested.

Regards,
Frank

--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-04 11:07 ` Frank Fesevur
@ 2009-01-04 13:09   ` Jeenu V
  2009-01-05 11:27   ` Hongyi Zhao
  1 sibling, 0 replies; 12+ messages in thread
From: Jeenu V @ 2009-01-04 13:09 UTC (permalink / raw)
  To: cygwin

On Sun, Jan 4, 2009 at 4:01 PM, Frank Fesevur
<ffes@users.sourceforge.net> wrote:
> Hongyi Zhao wrote:
>
>> I've some cygwin/bash scripts and I want to invoke them without log
>> into the Cygwin's bash terminal.  Is this possible?
>
> I have written a small utility named 'weft' that can set a file
> association to start .sh-files with a cygwin bash by double clicking
> it in the Explorer. I don't have it here anymore, so I have to dig
> that up in my archives if you interested.
>

Do you really need a utility for that? I mean you could always do that
with Windows explorer - Tools->Folder Options; at the File Types tab,
you can associate .sh files with bash executable. Or use the context
menu Open With and then browse and select bash.exe, with "Always use
this program .." option checked.

Alternatively, place the following thing into a batch file (.bat) and
double-click it.

c:\your\path\to\bash.exe your_script.sh

-- 
:J

--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-04 10:37 Trick cmd.exe of Windows XP to run cygwin Batch Script Hongyi Zhao
  2009-01-04 11:07 ` Frank Fesevur
@ 2009-01-04 17:10 ` Spiro Trikaliotis
  2009-01-05 11:32   ` Hongyi Zhao
  2009-01-05 12:43   ` Hongyi Zhao
  1 sibling, 2 replies; 12+ messages in thread
From: Spiro Trikaliotis @ 2009-01-04 17:10 UTC (permalink / raw)
  To: cygwin

Hello,

* On Sun, Jan 04, 2009 at 06:20:20PM +0800 Hongyi Zhao wrote:
 
> I've some cygwin/bash scripts and I want to invoke them without log
> into the Cygwin's bash terminal.  Is this possible?

d:\> bash -c ./myscript

Note that you might have to add the path to bash (c:\cygwin\bin\bash or
similar) in case it is not in your path. Also, you might want/need to
add --login or -l to the options of bash.

HTH,
Spiro.

-- 
Spiro R. Trikaliotis                              http://opencbm.sf.net/
http://www.trikaliotis.net/                     http://www.viceteam.org/

--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-04 11:07 ` Frank Fesevur
  2009-01-04 13:09   ` Jeenu V
@ 2009-01-05 11:27   ` Hongyi Zhao
  2009-01-06 17:54     ` Frank Fesevur
  1 sibling, 1 reply; 12+ messages in thread
From: Hongyi Zhao @ 2009-01-05 11:27 UTC (permalink / raw)
  To: cygwin

On Sun, 4 Jan 2009 11:31:42 +0100, "Frank Fesevur"
<ffes@users.sourceforge.net> wrote:
>I have written a small utility named 'weft' that can set a file
>association to start .sh-files with a cygwin bash by double clicking
>it in the Explorer. I don't have it here anymore, so I have to dig
>that up in my archives if you interested.

Very good, would you kindly give me a copy of this utility if you've
found it?

Regards,

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-04 17:10 ` Spiro Trikaliotis
@ 2009-01-05 11:32   ` Hongyi Zhao
  2009-01-05 16:34     ` Robert Pendell
  2009-01-05 12:43   ` Hongyi Zhao
  1 sibling, 1 reply; 12+ messages in thread
From: Hongyi Zhao @ 2009-01-05 11:32 UTC (permalink / raw)
  To: cygwin

On Sun, 4 Jan 2009 12:07:31 +0100, Spiro Trikaliotis
<an-cygwin@spiro.trikaliotis.net> wrote:

>Hello,
>
>* On Sun, Jan 04, 2009 at 06:20:20PM +0800 Hongyi Zhao wrote:
> 
>> I've some cygwin/bash scripts and I want to invoke them without log
>> into the Cygwin's bash terminal.  Is this possible?
>
>d:\> bash -c ./myscript

I've use the command: 

bash -c "help set"

to find that bash accept the following option:

       -C  If set, disallow existing regular files to be overwritten
           by redirection of output.

But, I cann't find the *-c* parameter used here, could you please give
me some hints?

>
>Note that you might have to add the path to bash (c:\cygwin\bin\bash or
>similar) in case it is not in your path. Also, you might want/need to
>add --login or -l to the options of bash.

Again, the bash's built-in help doesn't give me the abbr. *-l* for
*--login*, any hints on this?

Regards,

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-04 17:10 ` Spiro Trikaliotis
  2009-01-05 11:32   ` Hongyi Zhao
@ 2009-01-05 12:43   ` Hongyi Zhao
  1 sibling, 0 replies; 12+ messages in thread
From: Hongyi Zhao @ 2009-01-05 12:43 UTC (permalink / raw)
  To: cygwin

On Sun, 4 Jan 2009 12:07:31 +0100, Spiro Trikaliotis
<an-cygwin@spiro.trikaliotis.net> wrote:
>d:\> bash -c ./myscript

I've tested the above code and work it out like this:

set cygwin_bin=C:\cygwin\bin
%cygwin_bin%\bash -l %~dp0myscript > myresult

In the above example by me,  we need to pay attention to the following
matters:

1- %~dp0myscript mean that the file myscript is located at the same
directory as the bat file, i.e, the batch file which include the above
patch codes I posted here.  This batch file will invoke the bash
script file myscript.

2- the -c parameter used by you shouldn't be used here, if I used it,
I will meet the errors like this:

... command not found

3- The --login or -l must be used here, otherewise the following error
will be occur like this:

myscript: line 1: awk : command not found

4- The path name conventions in the invoking of this batch file, the
dos rule, i.e., _\_,  should be used instead of the bash convention,
i.e., _/_, as the delimitor of path.

5- In your case,

>d:\> bash -c ./myscript

actully, in the usage, the file myscript must ba put into the bash's
directory, i.e., C:\cygwin\bin.  This is not a convenient solution.

Regards,

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-05 11:32   ` Hongyi Zhao
@ 2009-01-05 16:34     ` Robert Pendell
  2009-01-06 17:49       ` Hongyi Zhao
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pendell @ 2009-01-05 16:34 UTC (permalink / raw)
  To: cygwin

Hongyi Zhao wrote:
> On Sun, 4 Jan 2009 12:07:31 +0100, Spiro Trikaliotis
> <an-cygwin@spiro.trikaliotis.net> wrote:
> 
>> Hello,
>>
>> * On Sun, Jan 04, 2009 at 06:20:20PM +0800 Hongyi Zhao wrote:
>>
>>> I've some cygwin/bash scripts and I want to invoke them without log
>>> into the Cygwin's bash terminal.  Is this possible?
>> d:\> bash -c ./myscript
> 
> I've use the command: 
> 
> bash -c "help set"
> 
> to find that bash accept the following option:
> 
>        -C  If set, disallow existing regular files to be overwritten
>            by redirection of output.
> 
> But, I cann't find the *-c* parameter used here, could you please give
> me some hints?
> 
>> Note that you might have to add the path to bash (c:\cygwin\bin\bash or
>> similar) in case it is not in your path. Also, you might want/need to
>> add --login or -l to the options of bash.
> 
> Again, the bash's built-in help doesn't give me the abbr. *-l* for
> *--login*, any hints on this?
> 
> Regards,
> 

For all of the above you probably wouldn't find anything in bash 
built-in help docs.  You would find it in the man page for bash.  Type 
'man bash' in a cygwin window and you will find both -l and -c defined 
there.  Just for reference...

-l - Make bash act as if it had been invoked as a login shell.
--login - Same as -l.

-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.

http://cygwin.com/acronyms/#RTFM

-- 
Robert Pendell
shinji@elite-systems.org

"A perfect world is one of chaos."

Thawte Web of Trust Notary
CAcert Assurer

--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-05 16:34     ` Robert Pendell
@ 2009-01-06 17:49       ` Hongyi Zhao
  0 siblings, 0 replies; 12+ messages in thread
From: Hongyi Zhao @ 2009-01-06 17:49 UTC (permalink / raw)
  To: cygwin

On Mon, 05 Jan 2009 08:51:11 -0500, Robert Pendell
<shinji@elite-systems.org> wrote:
>For all of the above you probably wouldn't find anything in bash 
>built-in help docs.  You would find it in the man page for bash.  Type 
>'man bash' in a cygwin window and you will find both -l and -c defined 
>there.  Just for reference...
>
>-l - Make bash act as if it had been invoked as a login shell.
>--login - Same as -l.
>
>-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.
>
>http://cygwin.com/acronyms/#RTFM

Thanks for your detailed explanations.

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-05 11:27   ` Hongyi Zhao
@ 2009-01-06 17:54     ` Frank Fesevur
  2009-01-07  5:33       ` Jared Silva
  2009-01-08 10:34       ` Hongyi Zhao
  0 siblings, 2 replies; 12+ messages in thread
From: Frank Fesevur @ 2009-01-06 17:54 UTC (permalink / raw)
  To: cygwin

Hongyi Zhao wrote:
>>I have written a small utility named 'weft' that can set a file
>>association to start .sh-files with a cygwin bash by double clicking
>>it in the Explorer. I don't have it here anymore, so I have to dig
>>that up in my archives if you interested.
>
> Very good, would you kindly give me a copy of this utility if you've
> found it?

Found it.

You can download it from:
  http://www.fesevur.com/downloads/weft-0.4-1.tar.bz2
  http://www.fesevur.com/downloads/weft-0.4-1-src.tar.bz2

As you can see it was developed back in 2006. It works for me just
fine. There is one known problems: it does not work properly on a UNC
styled path. At the moment I have no plans to continue developing it.
Maybe if people are interested...

Regards,
Frank

--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-06 17:54     ` Frank Fesevur
@ 2009-01-07  5:33       ` Jared Silva
  2009-01-08 10:34       ` Hongyi Zhao
  1 sibling, 0 replies; 12+ messages in thread
From: Jared Silva @ 2009-01-07  5:33 UTC (permalink / raw)
  To: cygwin

$ cat post-commit.bat
SET BIN=D:\UNIX\cygwin\bin
SET DPN_TMP=%TMP%\%~nx0
"%BIN%\cygpath.exe" -au "%~dpn0" > "%DPN_TMP%"
SET /P DPN= < "%DPN_TMP%"
DEL "%DPN_TMP%"
"%BIN%\bash.exe" "%DPN%.sh" %* >> "%~dpn0.log" 2>&1

The above BAT file will run post-commit.sh (because the name of the
BAT file is post-commit.bat) and write standard output and standard
error to post-commit.log.  I do not have time to explain all of the
details, but the two links below will help clarify the Windows side of
things.

http://www.ss64.com/nt/syntax-args.html
http://www.ss64.com/nt/set.html

--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Trick cmd.exe of Windows XP to run cygwin Batch Script.
  2009-01-06 17:54     ` Frank Fesevur
  2009-01-07  5:33       ` Jared Silva
@ 2009-01-08 10:34       ` Hongyi Zhao
  1 sibling, 0 replies; 12+ messages in thread
From: Hongyi Zhao @ 2009-01-08 10:34 UTC (permalink / raw)
  To: cygwin

On Tue, 6 Jan 2009 16:09:48 +0100, "Frank Fesevur"
<ffes@users.sourceforge.net> wrote:
>Found it.
>
>You can download it from:
>  http://www.fesevur.com/downloads/weft-0.4-1.tar.bz2
>  http://www.fesevur.com/downloads/weft-0.4-1-src.tar.bz2
>
>As you can see it was developed back in 2006. It works for me just
>fine. There is one known problems: it does not work properly on a UNC
>styled path. At the moment I have no plans to continue developing it.
>Maybe if people are interested...

Thanks a lot, I'll try to use it on my box.

Regards,

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


--
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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-01-08  9:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-04 10:37 Trick cmd.exe of Windows XP to run cygwin Batch Script Hongyi Zhao
2009-01-04 11:07 ` Frank Fesevur
2009-01-04 13:09   ` Jeenu V
2009-01-05 11:27   ` Hongyi Zhao
2009-01-06 17:54     ` Frank Fesevur
2009-01-07  5:33       ` Jared Silva
2009-01-08 10:34       ` Hongyi Zhao
2009-01-04 17:10 ` Spiro Trikaliotis
2009-01-05 11:32   ` Hongyi Zhao
2009-01-05 16:34     ` Robert Pendell
2009-01-06 17:49       ` Hongyi Zhao
2009-01-05 12:43   ` Hongyi Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).