Re: comments inside command subst are handled inconsistently

2023-07-31 Thread Ángel
On 2023-07-31 at 09:15 -0400, Chet Ramey wrote: > On 7/30/23 2:21 PM, Martin D Kealey wrote: > > > Seriously though, the internet is awash with "helpful" Shell guides > > and > > examples loaded with poor practices. The only way this is going to > > improve > > is if there's a "linting mode" is

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread G. Branden Robinson
At 2023-07-31T16:08:31+0200, Denys Vlasenko wrote: > There is no reason to innovate in tools such as sed, awk, or sh. These are terrible examples to use; look at the history of all three. > They have fossilized. No, they've been _standardized_. POSIX acknowledges that the common set of expected

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread Denys Vlasenko
On 7/31/23 15:07, Chet Ramey wrote: On 7/31/23 7:38 AM, Denys Vlasenko wrote: In the spirit of increased compatibility across Unix world, it'd be quite useful if shells stop inventing incompatible "extensions". That's an excellent way to stifle innovation. There is no reason to innovate in

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread Chet Ramey
On 7/30/23 2:21 PM, Martin D Kealey wrote: Seriously though, the internet is awash with "helpful" Shell guides and examples loaded with poor practices. The only way this is going to improve is if there's a "linting mode" is included in the Shell and on by default. Does shellcheck warn about f

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread Chet Ramey
On 7/31/23 8:22 AM, G. Branden Robinson wrote: [John Mashey, the author of the predecessor Unix shell (and successor to Ken Thompson's original Unix shell) has gone on record as "goading" Bourne into doing questionable things in the quest for speed. This is true. Mashey's v6 she

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread Chet Ramey
On 7/31/23 7:38 AM, Denys Vlasenko wrote: In the spirit of increased compatibility across Unix world, it'd be quite useful if shells stop inventing incompatible "extensions". That's an excellent way to stifle innovation. The "function" keyword, for example. Why does it even exists? You're

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread G. Branden Robinson
Hi Denys, At 2023-07-31T13:38:00+0200, Denys Vlasenko wrote: > On 7/28/23 19:51, Martin D Kealey wrote: > > On the other hand, since everyone has now had 36+ years to update > > their scripts to get rid of backticks, > > I don't know about others, but I missed the memo that `` is > deprecated. T

Re: comments inside command subst are handled inconsistently

2023-07-31 Thread Denys Vlasenko
On 7/28/23 19:51, Martin D Kealey wrote: On the other hand, since everyone has now had 36+ years to update their scripts to get rid of backticks, I don't know about others, but I missed the memo that `` is deprecated. Please do not break compatibility. The importance of compatibility is some

Re: comments inside command subst are handled inconsistently

2023-07-30 Thread Martin D Kealey
On Sun, 30 Jul 2023, 08:22 Chet Ramey, wrote: > On 7/28/23 1:51 PM, Martin D Kealey wrote: > > > maybe it's time to start issuing a warning > > when [backticks are] used at all? 🤪 > > There's no reason to use `` over $(...), but that form is still a required > POSIX expansion. Oh, then only war

Re: comments inside command subst are handled inconsistently

2023-07-29 Thread Chet Ramey
On 7/28/23 1:51 PM, Martin D Kealey wrote: On the other hand, since everyone has now had 36+ years to update their scripts to get rid of backticks, maybe it's time to start issuing a warning when they're used at all? 🤪 There's no reason to use `` over $(...), but that form is still a required

Re: comments inside command subst are handled inconsistently

2023-07-29 Thread Chet Ramey
On 7/27/23 4:31 AM, Denys Vlasenko wrote: Try these two commands: $ echo "Date: `date #comment`" Date: Thu Jul 27 10:28:13 CEST 2023 $ echo "Date: $(date #comment)" )" Date: Thu Jul 27 10:27:58 CEST 2023 As you see, #comment is handled differently in `` and $(). Yes. There's a hint in the

Re: comments inside command subst are handled inconsistently

2023-07-28 Thread Martin D Kealey
On Thu, 27 Jul 2023, 18:31 Denys Vlasenko, wrote: > Try these two commands: > > $ echo "Date: `date #comment`" > Date: Thu Jul 27 10:28:13 CEST 2023 > > $ echo "Date: $(date #comment)" > > )" > Date: Thu Jul 27 10:27:58 CEST 2023 > > > As you see, #comment is handled differently in `` and $(). >

Re: comments inside command subst are handled inconsistently

2023-07-27 Thread Dale R. Worley
Denys Vlasenko writes: > Try these two commands: > > $ echo "Date: `date #comment`" > Date: Thu Jul 27 10:28:13 CEST 2023 > > $ echo "Date: $(date #comment)" >> )" > Date: Thu Jul 27 10:27:58 CEST 2023 > > As you see, #comment is handled differently in `` and $(). > I think the handling in `` make

comments inside command subst are handled inconsistently

2023-07-27 Thread Denys Vlasenko
Try these two commands: $ echo "Date: `date #comment`" Date: Thu Jul 27 10:28:13 CEST 2023 $ echo "Date: $(date #comment)" )" Date: Thu Jul 27 10:27:58 CEST 2023 As you see, #comment is handled differently in `` and $(). I think the handling in `` makes more sense.