Re:Show HN: sol – A de-minifier for shell programs
by yjftsjthsd-h on Wednesday September 18, 2024 @10:27AM
(#41580133)
A pattern I typically do
or so, which is less verbose but short and sweet. Obviously slightly different, but : (no-op) seems applicable to your situation.
[ Parent
| on HN ]
Re:Show HN: sol – A de-minifier for shell programs
by ramses0 on Wednesday September 18, 2024 @10:54AM
(#41580479)
Clever! ...almost TOO clever... ;-)
That's a great technique, but the `:` as no-op is tough to expect bash-normies to understand (and a tough "operator" to search for). Thanks for sharing, it'll definitely stay in my back pocket!
Re:Show HN: sol – A de-minifier for shell programs
by js2 on Wednesday September 18, 2024 @12:24PM
(#41581933)
You don't need the backslashes in that case. As with lines ending in pipes and a few other places, the line continuation is implicit after the &&:
https://unix.stackexchange.com/questions/253518/where-are-ba...
Re:Show HN: sol – A de-minifier for shell programs
by yjftsjthsd-h on Wednesday September 18, 2024 @02:13PM
(#41583489)
Huh, neat. So I picked that habit up from writing Dockerfiles, which does let you do
RUN foo && \
bar && \
:
but not RUN foo &&
bar &&
:
(I just tested it), but more recently you can just write RUN <<EOF
foo
bar
EOF
so with the caveat of needing to `set -e` the whole thing might be a moot point now:)