delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/07/15:36:08

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT 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
To: cygwin AT cygwin DOT com
References: <DB6P18901MB005559D81FD4125B0D6DAA07A4919 AT DB6P18901MB0055 DOT EURP189 DOT PROD DOT OUTLOOK DOT COM>
<44687390 DOT 20230406152114 AT yandex DOT 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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT Shaw DOT ca>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019