Timeline for answer to With `#!/bin/sh`, what is the closest to `;;&` (`bash`'s fallthrough)? by Ed Morton
Current License: CC BY-SA 4.0
Post Revisions
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 29, 2025 at 18:12 | history | edited | Ed Morton | CC BY-SA 4.0 |
added 17 characters in body
|
| Oct 29, 2025 at 14:44 | comment | added | Ed Morton |
@StéphaneChazelas when you said noways - was that a typo and you meant nowadays? I suspect I have been thinking of the Bourne shell from days of yore when I think of sh.
|
|
| Oct 29, 2025 at 14:15 | comment | added | Toby Speight |
@Ed, yes I did mean that the variables should be set false before the code in question. There are alternatives (e.g. evaluating with a fallback: ${set_cflags-false}), but I feel that then goes backwards again on the readability.
|
|
| Oct 29, 2025 at 13:44 | comment | added | Stéphane Chazelas |
If you have a system that doesn't have a sh utility, then it's off-topic here. Don't confuse sh (noways an interpreter for the POSIX shell language based on a subset of the ksh88 language) with the Bourne shell (its predecessor) or its clones or the Thompson shell which predates it. There are POSIX sh implementations based on the Bourne shell such as bosh or ksh88 and some based on some of its clones such as dash (based on Almquist shell) or mksh (based on Forsyth shell)
|
|
| Oct 29, 2025 at 13:20 | history | edited | Ed Morton | CC BY-SA 4.0 |
added 657 characters in body
|
| Oct 29, 2025 at 12:53 | comment | added | Ed Morton |
@TobySpeight it's been so long since I used sh (40 years maybe?), that a) I don't remember much about it's syntax and, b) I think it's syntax may have evolved since I last used it, and I don't have sh on any machine I have access to to test with so I was just sticking to the basics I was 99% sure of :-). If storing a true/false command in the variable works - sounds good. Although, I expect that'd mean you'd need to add code to initialise them all to false before the case but that's not a bad idea anyway.
|
|
| Oct 29, 2025 at 12:50 | comment | added | Toby Speight |
Perhaps not to your taste, but an option I sometimes use is for the variables to hold commands - namely false or true. Then we are able to if $set_cflags with no need to execute [.
|
|
| Oct 29, 2025 at 12:46 | history | answered | Ed Morton | CC BY-SA 4.0 |