public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: "Nellis, Kenneth" <Kenneth.Nellis@xerox.com>, cygwin@cygwin.com
Subject: Re: how to embed shell script within a .BAT file
Date: Sun, 09 Nov 2014 22:05:00 -0000	[thread overview]
Message-ID: <71156572.20141110005807@yandex.ru> (raw)
In-Reply-To: <0D835E9B9CD07F40A48423F80D3B5A702E8379F0@USA7109MB022.na.xerox.net>

Greetings, Nellis, Kenneth!

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

google: cygwin shell wrapper script
I posted mine in the mailing list not once, and it's not the only available
solution.

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

It is technically possible to invoke specific processor for a bat file, but no
Cygwin tools understand the necessary syntax. Your only option is to create
proper association(s) for your favorite extensions.

FTYPE unixshell.script="C:\Programs\Cygwin_64\bin\env.exe" -- /bin/cygwrap.sh "%1" %*
ASSOC .sh=unixshell.script
ASSOC .awk=unixshell.script
ASSOC .pl=unixshell.script
ASSOC .whatver=unixshell.script

The wrapper is as simple as

-------->8-------->8-------->8-------->8--------
#!/bin/sh

test -z "$1" && exit 1

/bin/env -- "$(cygpath -au "$1")" "${@:2}"
--------8<--------8<--------8<--------8<--------

Don't forget to add your favorite extensions to PATHEXT, else you won't be
able to run them scripts from CMD.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 10.11.2014, <00:51>

Sorry for my terrible english...


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

  parent reply	other threads:[~2014-11-09 22:05 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
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 [this message]
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=71156572.20141110005807@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --cc=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).