bash shell script: recently running, now failing
Brian Inglis
Brian.Inglis@Shaw.ca
Fri Apr 7 19:34:49 GMT 2023
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
More information about the Cygwin
mailing list