bash shell script: recently running, now failing
Andrey Repin
anrdaemon@yandex.ru
Sat Apr 8 08:37:17 GMT 2023
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...
More information about the Cygwin
mailing list