public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: Brian Inglis via Cygwin <cygwin@cygwin.com>, cygwin@cygwin.com
Subject: Re: bash shell script: recently running, now failing
Date: Sat, 8 Apr 2023 11:37:17 +0300	[thread overview]
Message-ID: <829298512.20230408113717@yandex.ru> (raw)
In-Reply-To: <6bb05948-2362-6cb8-532a-2dfd59a746d3@Shaw.ca>

Greetings, Brian Inglis via Cygwin!

> On 2023-04-06 06:21, Andrey Repin via Cygwin wrote:
>>> I have a "hash bang" bash shell script i.e. first line
>>> #! /bin/sh
>>> or equivalently
>>> #! /bin/bash

>> By default, sh is bash in base Cygwin installation.

>>> Q3 - at 1/8 the size of bash and sh, I am not at all sure of the role and reach of dash.
>>> Should the edit (dash replacing bash/sh) be incorporated elsewhere or would this be a
>>> bad idea (and retained only locally in what is indeed an eccentric and one-off context)?

>> I'm replacing /bin/sh with dash as I've found that even in POSIX mode, bash
>> allows for a lot of bash'izms in scripts, which would not otherwise run under
>> (d?a)?sh.

>> See the post-install script attached.

> You should use either a hard link or copy of d/ash from/to /bin/ to allow
> it (or any shell) to be used from Windows cmd shells or Scheduled Tasks,

That depends on your setup. /usr/bin/env is a real executable and it is a VERY
good idea to handle Windows associations through it.
But on my end it is covered by CYGWIN=winsymlinks:nativestrict and a more
elaborate TCC-RT wrapper script which is again falling down to /usr/bin/env for
the purposes of actually starting the program, be it a script or binary or…

> which do not recognise Cygwin /usr mounts or symlinks, but can be run with
> elevated privileges and at sometimes more useful points than user cron jobs.
> For example, "manually" restarting Cygwin services after delayed startup,
> stopping Cygwin services and processes before upgrades, and cleaning up cron
> jobs that have not finished.

That part is handled elsewhere already.

> You should also consider changing the sh man page.

That's a good idea, thanks. I never did "man sh" so never stumbled across that
discrepancy.


-- 
With best regards,
Andrey Repin
Saturday, April 8, 2023 11:31:34

Sorry for my terrible english...

  reply	other threads:[~2023-04-08  8:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06  4:43 Fergus Daly
2023-04-06  8:03 ` Corinna Vinschen
2023-04-06 12:23   ` Scott Smith
2023-04-06 12:21 ` Andrey Repin
2023-04-07 19:34   ` Brian Inglis
2023-04-08  8:37     ` Andrey Repin [this message]
2023-04-06 17:18 ` Adam Dinwoodie
2023-04-06 19:26   ` Scott Smith

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=829298512.20230408113717@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --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).