public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: Fergus Daly <fergusd84@outlook.com>, cygwin@cygwin.com
Subject: Re: bash shell script: recently running, now failing
Date: Thu, 6 Apr 2023 15:21:14 +0300	[thread overview]
Message-ID: <44687390.20230406152114@yandex.ru> (raw)
In-Reply-To: <DB6P18901MB005559D81FD4125B0D6DAA07A4919@DB6P18901MB0055.EURP189.PROD.OUTLOOK.COM>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Greetings, Fergus Daly!

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


-- 
With best regards,
Andrey Repin
Thursday, April 6, 2023 15:18:19

Sorry for my terrible english...

[-- Attachment #2: zp_dash-as-bin-sh.dash --]
[-- Type: application/octet-stream, Size: 279 bytes --]

#!/bin/dash

[ -f /bin/dash.exe ] || exit

_f="$(mktemp /bin/sh.prelink.XXXXXX)"

[ -L /bin/sh.exe ] || mv /bin/sh.exe "$_f"

ln -fsT /bin/dash.exe /bin/sh.exe
if [ $? -gt 0 ]; then
    echo "Got a problem creating link for /bin/sh !" >&2
    exit 1
else
    rm "$_f"
fi

exit 0

  parent reply	other threads:[~2023-04-06 12:35 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 [this message]
2023-04-07 19:34   ` Brian Inglis
2023-04-08  8:37     ` Andrey Repin
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=44687390.20230406152114@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --cc=cygwin@cygwin.com \
    --cc=fergusd84@outlook.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).