help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed with Variable Substitution in the command


From: Greg Wooledge
Subject: Re: sed with Variable Substitution in the command
Date: Fri, 27 Sep 2024 07:53:13 -0400

On Fri, Sep 27, 2024 at 13:35:04 +0200, alex xmb sw ratchev wrote:
> huuuu , yeah fail test
> 
> {13..1}
> bash returns wrong 1 at end for $11
> yes
> uhhhhh ... how ' new ' or ' old ' is this

It's *extremely* old.

hobbit:~$ echo "$BASH_VERSION"
2.05b.0(1)-release
hobbit:~$ set -- a b c d e f g h i j k l m n o
hobbit:~$ echo "$11"
a1

It goes back to the original Bourne shell as far as I know.

> but gawk says it got it right , $11 being 3
> 
> a=( {13..1} ) ; gawk <<<${a[*]} ' { print $11 } '
> 
> weird .. i might have suxxed that knowledge from long ago ...
> hmm

Yes, awk and shell syntax *look* similar in many cases where they actually
have different behaviors.  It's easy to get a bit confused when you're
mixing languages.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]