From: "Nellis, Kenneth" <Kenneth.Nellis@xerox.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: how to embed shell script within a .BAT file
Date: Mon, 10 Nov 2014 14:49:00 -0000 [thread overview]
Message-ID: <0D835E9B9CD07F40A48423F80D3B5A702E839BB9@USA7109MB022.na.xerox.net> (raw)
In-Reply-To: <545D3E21.2030306@bopp.net>
> From: Jeremy Bopp
>
> On 11/07/2014 03:26 PM, Nellis, Kenneth wrote:
> > I'm tired of creating pairs of script files: a clickable .BAT file to
> > invoke my shell script and then my shell script to do the actual work.
> > I was wondering if any of the geniuses on this list have come up with
> > a way to embed a shell script inside a clickable .BAT file.
> Something like this might do. It assumes you know the path to the Cygwin
> bin directory. Passing in arguments would be a bit more work and would
> probably be somewhat limited unless you have a small number of possible
> arguments.
>
> FYI, I don't have a Windows system readily available anymore, so this is
> untested.
>
> Shelly.bat:
>
> @echo off
>
> rem Put Cygwin bin directory into PATH
> set PATH=C:\cygwin\bin;%PATH%
>
> type %0 | sed "0,/^---BASH SCRIPT FOLLOWS---/ d; s/\r*$//" | bash
> goto :eof
>
> ---BASH SCRIPT FOLLOWS---
> echo $SHELL is alive
> ^Z
Thanx to Jeremy, Andrey, and the others who responded.
Jeremy's solution is closest to what I was looking for; however
I need it to work from a networked, non-drive-mapped folder.
(CMD.EXE doesn't like UNC paths.) I hadn't realized that I could
pipe a script into bash.
Andrey also suggested something that allows Windows-clickable
script files, a strict requirement, bypassing the stated, but
unnecessary requirement that it be a .BAT file, by associating
a file type with bash. This would bypass the UNC issue, so may
end up being the best solution for me.
--Ken Nellis
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2014-11-10 14:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 21:26 Nellis, Kenneth
2014-11-07 21:32 ` Eric Blake
2014-11-09 22:05 ` Andrey Repin
2014-11-07 21:48 ` Jeremy Bopp
2014-11-07 21:54 ` Eliot Moss
2014-11-10 14:49 ` Nellis, Kenneth [this message]
2014-11-10 18:09 ` Achim Gratz
2014-11-11 16:12 ` Nellis, Kenneth
2014-11-11 20:05 ` Andrey Repin
2014-11-10 19:05 ` Andrey Repin
2014-11-10 20:13 ` Andrew DeFaria
2014-11-10 21:05 ` Andrey Repin
2014-11-09 22:05 ` Andrey Repin
2014-11-10 0:35 ` Mike Brown
2014-11-10 2:20 ` Andrey Repin
2014-11-10 4:24 ` Mike Brown
2014-11-09 23:01 ` cyg Simple
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0D835E9B9CD07F40A48423F80D3B5A702E839BB9@USA7109MB022.na.xerox.net \
--to=kenneth.nellis@xerox.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).