Re: s6-test -v does not work for variable "!"

2022-09-05 Thread Laurent Bercot
So there are several things. - "=" is not a legit envvar name: envvar names cannot include a '=' character. "!" is absolutely a legit envvar name, though, and execline uses it with commands such as background or pipeline. - execline does not understand single quotes. '!' will translate

Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread Laurent Bercot
As other people said, using "if" instead of "foreground" is the idiomatic way to exit on child error. I myself am a staunch "#!/bin/sh -e" user, and almost never use "foreground" in execline scripts - only when I specifically need the exit code of some command. Forwarding signals to a child

Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread cat æscling via skaware
The point is correct; using if instead of foreground sounds like what is wanted here (Though in this case the rest of the script wouldn’t run in the data directory; besides,`execline-cd data [etc]` would just error out immediately.)

Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread Brett Neumeier
Perhaps just wrap each preparation command in an if block? if { execline-cd data } Will continue the script if execline-cd succeeds, and abort if it does not. On Mon, Sep 5, 2022, 1:54 PM Saj Goonatilleke via skaware < skaware@list.skarnet.org> wrote: > Hello, > > Within the context of, say,

Re: s6-test -v does not work for variable "!"

2022-09-05 Thread Songbo Wang
On 9/5/22 22:15, alice wrote: On Mon Sep 5, 2022 at 10:08 PM CEST, Songbo Wang wrote: #!/usr/bin/execlineb -P export ! 0 s6-test -v '\!' changing this to s6-test -v \\\! works as expected. Thanks for the reply. It indeed works. But there is one thing I find counter-intuitive: s6-test

Re: s6-test -v does not work for variable "!"

2022-09-05 Thread cat æscling via skaware
When the environment modification takes place with export is unintuitive; try ``` #!/usr/bin/execlineb -P export ! 0 foreground { exit } s6-test -v '\!' ```

Re: s6-test -v does not work for variable "!"

2022-09-05 Thread alice
On Mon Sep 5, 2022 at 10:08 PM CEST, Songbo Wang wrote: > On 9/5/22 20:57, alice wrote > > s6-test -v '\!' > > seems to work for me, tested with > > env !=1 s6-test -v'\!' > > and without the env. maybe i'm misreading it? > > > Your example works for me on bash, but I just tested by the

Re: s6-test -v does not work for variable "!"

2022-09-05 Thread Songbo Wang
On 9/5/22 20:57, alice wrote > s6-test -v '\!' > seems to work for me, tested with > env !=1 s6-test -v'\!' > and without the env. maybe i'm misreading it? > Your example works for me on bash, but I just tested by the following execline script #!/usr/bin/execlineb -P exec -c s6-test -v !

Re: s6-test -v does not work for variable "!"

2022-09-05 Thread alice
On Mon Sep 5, 2022 at 8:42 PM CEST, Songbo Wang wrote: > Hi, > > I've been recently playing with execline scripts and found out that > s6-test -v ! s6-test -v '\!' seems to work for me, tested with env !=1 s6-test -v'\!' and without the env. maybe i'm misreading it? > is not able to test if the !

Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread Saj Goonatilleke via skaware
Hello, Within the context of, say, an s6 run script that needs to do a little bit of prep work before execing into a server, it is often helpful to abort early if any of said prep work stumbles upon an unexpected problem. Maybe the filesystem is R/O. Or full. Maybe an operator has fat-fingered

s6-test -v does not work for variable "!"

2022-09-05 Thread Songbo Wang
Hi, I've been recently playing with execline scripts and found out that s6-test -v ! is not able to test if the ! environment variable is set. I guess it is because s6-test would also need to handle expressions like "x != y", but the code is too mystic for me to understand (by the way, s6-test