X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B6763857700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1680896127;
	bh=K1BxOXZFl21Hv3OwxL0HslxeDFdsKYqkPTy+tDgbB30=;
	h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=c2iK7I8Ssm5Feo86fQbZ91FdGYvQPLUcNQiDiQacw2Qd6DFE4qxooejw67Gjq1RJ3
	 dTksEwzzgNl26k8ofoFLIGse0UaFDU7CpNBZ0N+RUPTYgeAzxrpw9RcHJFD8wT/C8B
	 DiQf6fAehAsupcn3xt4dz0mmzmf9TMzraOdWHJ4E=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BE8E3858D32
X-Authority-Analysis: v=2.4 cv=e5oV9Il/ c=1 sm=1 tr=0 ts=64307059
 a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17
 a=IkcTkHD0fZMA:10 a=pgErXLZoTj4Q0FFUzHAA:9 a=QEXdDO2ut3YA:10
Message-ID: <6bb05948-2362-6cb8-532a-2dfd59a746d3@Shaw.ca>
Date: Fri, 7 Apr 2023 13:34:49 -0600
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
 Thunderbird/102.9.1
Subject: Re: bash shell script: recently running, now failing
Content-Language: en-CA
To: cygwin@cygwin.com
References: <DB6P18901MB005559D81FD4125B0D6DAA07A4919@DB6P18901MB0055.EURP189.PROD.OUTLOOK.COM>
 <44687390.20230406152114@yandex.ru>
Organization: Inglis
In-Reply-To: <44687390.20230406152114@yandex.ru>
X-CMAE-Envelope: MS4xfPh8XVkpKQhZuEJTa7Y21cgSEZ24FAvOUvZBWPW2Zm4QYNkYu7/Xl2bbGqjPC5oCZ57Z1hV0SlgmhjJCScyt46gcZgOKQNPbAorc2Y3dBcANF/9GN9Fe
 Vqn2H+KAwzEGmKaE+TlrT7Mo8jjyxsYbwxv/5dGYTBWG1VZoC8z0urdJadmeixOuK/9cOcj3iUu7KQ==
X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW,
 SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Brian Inglis <Brian.Inglis@Shaw.ca>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 337JZnnO010908

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, 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.
You should also consider changing the sh man page.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

