Bruno Haible wrote: > Jim Meyering wrote: >> However, I would find the above code easier to read if it were >> written on fewer lines: >> >> case "$host_os" in >> *-gnu*) $1 ;; # Guess yes on glibc systems. >> *) $2 ;; # If we don't know, assume the worst. >> esac > > Will it also work if $1 or $2 contains an m4 comment (dnl something) > or ends in a shell comment (# something)?
I don't think "dnl" could cause trouble there: either the dnl and following comment are elided by m4 or they're inserted as literals to be processed later as shell commands. But you're right that a shell comment on the last line of the expansion of $1 or $2 would cause trouble, but only when there is no trailing newline. So finally I do prefer yours. > Also, I like to put comments about statements before the statements, > not afterwards. So do I, in general, but I like to keep case-related comments between the case-introducing "...)" syntax and the ";;" case-terminator. Otherwise, it seems too easy to miss the comment when re/moving a case block. Here, you're welcome to keep your commenting style.
