Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-19 Thread Steffen Nurpmeso
Hello Robert. Thanks again for your extensive answers. Robert Elz wrote in <2675.1726728...@jacaranda.noi.kre.to>: |Date:Thu, 19 Sep 2024 00:45:44 +0200 |From:Steffen Nurpmeso |Message-ID: <20240918224544.aXWgbZu-@steffen%sdaoden.eu> | || Woops. I did not know

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-19 Thread Chet Ramey
On 9/19/24 2:42 AM, Robert Elz wrote: Date:Thu, 19 Sep 2024 00:45:44 +0200 From:Steffen Nurpmeso Message-ID: <20240918224544.aXWgbZu-@steffen%sdaoden.eu> | Woops. I did not know that, i always separate {} at the beginning | an the end, yet not (). '(' and

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Robert Elz
Date:Thu, 19 Sep 2024 00:45:44 +0200 From:Steffen Nurpmeso Message-ID: <20240918224544.aXWgbZu-@steffen%sdaoden.eu> | Woops. I did not know that, i always separate {} at the beginning | an the end, yet not (). '(' and ')' (parentheses) are operators, '{' and '}'

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Steffen Nurpmeso
Robert Elz wrote in <5996.1726697...@jacaranda.noi.kre.to>: |Date:Wed, 18 Sep 2024 23:05:06 +0200 |From:Steffen Nurpmeso |Message-ID: <20240918210506.9rRUe2TG@steffen%sdaoden.eu> | || I am totally surprised they all swallow this code, there is no || separating w

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Robert Elz
Date:Wed, 18 Sep 2024 23:05:06 +0200 From:Steffen Nurpmeso Message-ID: <20240918210506.9rRUe2TG@steffen%sdaoden.eu> | I am totally surprised they all swallow this code, there is no | separating whitespace in between the ; and the } which closes the | function --

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Steffen Nurpmeso
Chet Ramey wrote in : |On 9/18/24 1:05 AM, Oğuz wrote: |> On Wed, Sep 18, 2024 at 4:19 AM Steffen Nurpmeso \ |> wrote: |> It boils down to this: |> |>f(){ echo $#;}; set "" "" ""; IFS=x; f $* |> |> bash, NetBSD and FreeBSD sh, and ksh88 all agree and print 2. pdksh |> prints 3 but

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Steffen Nurpmeso
Robert Elz wrote in <3946.1726671...@jacaranda.noi.kre.to>: ... || On Wed, Sep 18, 2024 at 08:05:10 +0300, Oğuz wrote: ||> It boils down to this: ||> f(){ echo $#;}; set "" "" ""; IFS=x; f $* | ||> bash, NetBSD and FreeBSD sh, and ksh88 all agree and print 2. pdksh ||> prints 3 but mksh

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Steffen Nurpmeso
Oğuz wrote in : |On Wed, Sep 18, 2024 at 4:19 AM Steffen Nurpmeso \ |wrote: |> | |It boils down to this: In this case, ok .. i have not spent time trying to vaporise it. I haved added this standalone thing to my tests. | f(){ echo $#;}; set "" "" ""; IFS=x; f $* | |bash, NetBSD and Fre

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Robert Elz
Date:Wed, 18 Sep 2024 07:21:30 -0400 From:Greg Wooledge Message-ID: | On Wed, Sep 18, 2024 at 08:05:10 +0300, Oğuz wrote: | > It boils down to this: | > f(){ echo $#;}; set "" "" ""; IFS=x; f $* | > bash, NetBSD and FreeBSD sh, and ksh88 all agree and pri

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Chet Ramey
On 9/18/24 1:05 AM, Oğuz wrote: On Wed, Sep 18, 2024 at 4:19 AM Steffen Nurpmeso wrote: It boils down to this: f(){ echo $#;}; set "" "" ""; IFS=x; f $* bash, NetBSD and FreeBSD sh, and ksh88 all agree and print 2. pdksh prints 3 but mksh and oksh print 1. dash, ksh93, yash, and zsh pri

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-18 Thread Greg Wooledge
On Wed, Sep 18, 2024 at 08:05:10 +0300, Oğuz wrote: > On Wed, Sep 18, 2024 at 4:19 AM Steffen Nurpmeso wrote: > > > > It boils down to this: > > f(){ echo $#;}; set "" "" ""; IFS=x; f $* > > bash, NetBSD and FreeBSD sh, and ksh88 all agree and print 2. pdksh > prints 3 but mksh and oksh print

Re: Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-17 Thread Oğuz
On Wed, Sep 18, 2024 at 4:19 AM Steffen Nurpmeso wrote: > It boils down to this: f(){ echo $#;}; set "" "" ""; IFS=x; f $* bash, NetBSD and FreeBSD sh, and ksh88 all agree and print 2. pdksh prints 3 but mksh and oksh print 1. dash, ksh93, yash, and zsh print 0.

Question on $IFS related differences (Was: Question on $@ vs $@$@)

2024-09-17 Thread Steffen Nurpmeso
Hello. I am terribly sorry to be here once again; i already mentioned on bug-bash@ the problem with IFS being reverse solidus that dash (and myself) has (have). I came back to this for my one again, and i stumble over one additional difference in behaviour in between (myself and) bash, dash and bu

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
cool .. gotta do .. thxx n greets .. On Tuesday, September 17, 2024, Greg Wooledge wrote: > On Tue, Sep 17, 2024 at 17:00:16 +0200, alex xmb sw ratchev wrote: > > plz what does 'local -' do , its newer to me > > i forgot all about it already > >local [option] [name[=value] ... | - ] >

Re: (question) fast split/join of strings

2024-09-17 Thread Greg Wooledge
On Tue, Sep 17, 2024 at 17:00:16 +0200, alex xmb sw ratchev wrote: > plz what does 'local -' do , its newer to me > i forgot all about it already local [option] [name[=value] ... | - ] For each argument, a local variable named name is created, and assigned valu

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
very respectable great email mate the set -f , ye i always missed it i gotta train me that more in the 1,2,,3 issue , id say thata valid cause ,, is literarly an empty field a second sep seems me great just as awk , one sep is for fields on a line , one is the per line sep set -f ; ss=$'\1\2' ss

Re: (question) fast split/join of strings

2024-09-17 Thread Greg Wooledge
On Tue, Sep 17, 2024 at 16:07:58 +0200, alex xmb sw ratchev wrote: > savedifs=${IFS@A} savedifs=${savedifs:- unset -v IFS } > str=1,2,3 IFS=, arr=( $str ) joined=${arr[*]} > eval "$savedifs" Using unquoted $str in an array expansion to do the splitting has a couple drawbacks: 1) Globbing (filenam

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
in the printf to stdout a final printf \\n is missing greets On Tuesday, September 17, 2024, alex xmb sw ratchev wrote: > savedifs=${IFS@A} savedifs=${savedifs:- unset -v IFS } > str=1,2,3 IFS=, arr=( $str ) joined=${arr[*]} > eval "$savedifs" > > alternative middleline > > sep=, str=1$sep2$sep

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
savedifs=${IFS@A} savedifs=${savedifs:- unset -v IFS } str=1,2,3 IFS=, arr=( $str ) joined=${arr[*]} eval "$savedifs" alternative middleline sep=, str=1$sep2$sep3 IFS=$sep arr=( $str ) joined=${arr[*]} ( at var=assignment , quotes dont matter , excepts to bind spaced code together as cmd or cmd

Re: (question) fast split/join of strings

2024-09-17 Thread Greg Wooledge
On Tue, Sep 17, 2024 at 02:56:05 -0400, Lawrence Velázquez wrote: > This question is more appropriate for help-bash than bug-bash. > > On Tue, Sep 17, 2024, at 2:21 AM, William Park wrote: > > For splitting, I'm aware of > > old="a,b,c" > >

Re: (question) fast split/join of strings

2024-09-16 Thread Lawrence Velázquez
This question is more appropriate for help-bash than bug-bash. On Tue, Sep 17, 2024, at 2:21 AM, William Park wrote: > Hi all, > > Is there fast way of splitting and joining of strings in the recent Bash > versions? Define "fast". > For splitting, I'm aware of

(question) fast split/join of strings

2024-09-16 Thread William Park
Hi all, Is there fast way of splitting and joining of strings in the recent Bash versions? For splitting, I'm aware of old="a,b,c" IFS=, read -a arr <<< "$old" For joining, new=$(IFS=,; echo "${arr[*]}") or new=$(IFS=,; echo "$*")

Re: Question on $@ vs $@$@

2024-08-29 Thread Steffen Nurpmeso
Dear Robert, i am totally distracted regarding this topic. I will carefully read it and the standard again. (We also have likely the last midsommer week here, and i am out whenever i can.) Thanks for taking the time to look that deeply into this issue. Robert Elz wrote in <12813.1724902...@jacara

Re: Question on $@ vs $@$@

2024-08-29 Thread Chet Ramey
On 8/28/24 11:41 PM, Robert Elz wrote: The reason all this is messy, is that it is (more or less) the way it was implemented in the original Bourne shell. That tells you that the implementation must be simple - the rules might seem complex to explain, but the implementation is sure to be simpl

Re: Question on $@ vs $@$@

2024-08-28 Thread Robert Elz
Date:Wed, 28 Aug 2024 02:03:54 +0200 From:Steffen Nurpmeso Message-ID: <20240828000354.qZaQvm7v@steffen%sdaoden.eu> | That confuses me again, unfortunately i got a bug report and | distracted. I mean, i would | | 1. skip leading whitespace anyhow (IFS or not,

Re: Question on $@ vs $@$@

2024-08-27 Thread Steffen Nurpmeso
Robert Elz wrote in <14146.1724799...@jacaranda.noi.kre.to>: |Date:Tue, 27 Aug 2024 22:02:34 +0200 |From:Steffen Nurpmeso |Message-ID: <20240827200234.95X76_wN@steffen%sdaoden.eu> | | || Any character in IFS delimits a field, adjacent IFS whitespace || char

Re: Question on $@ vs $@$@

2024-08-27 Thread Robert Elz
Date:Tue, 27 Aug 2024 22:02:34 +0200 From:Steffen Nurpmeso Message-ID: <20240827200234.95X76_wN@steffen%sdaoden.eu> | Any character in IFS delimits a field, adjacent IFS whitespace | characters are then ignored. Not quite. Any sequence of any amount of IFS

Re: Question on $@ vs $@$@

2024-08-27 Thread Steffen Nurpmeso
of IFS whitespace characters is also treated as |>|> a delimiter. |>|> |>|> So this means that *regardless* of whatever $IFS is, the three IFS |>|> whitespace characters are $IFS anyway *if* that is set to |>|> a nin-empty non-default value. |>| |>|Nonsense.

Re: Question on $@ vs $@$@

2024-08-27 Thread Chet Ramey
|> |> So this means that *regardless* of whatever $IFS is, the three IFS |> whitespace characters are $IFS anyway *if* that is set to |> a nin-empty non-default value. | |Nonsense. How you interpret this "also" if not so, that is the question. My impression was that yo

Re: Question on $@ vs $@$@

2024-08-26 Thread Steffen Nurpmeso
Lawrence Velázquez wrote in <972ac206-a601-4337-8dfc-77bbaef22...@app.fastmail.com>: |On Sat, Aug 24, 2024, at 10:08 PM, Steffen Nurpmeso wrote: |> One hopefully last thing in this regard for me, ... |This easily obfuscates the structure of the "$@" expansion. You'd |be better off with somet

Re: Question on $@ vs $@$@

2024-08-26 Thread Steffen Nurpmeso
alex xmb sw ratchev wrote in : |try | |${@@Q} | |and | |${*@Q} | |greets I try to avoid using non-portable shell stuff. I do not think these would be understood by the ash shell variants (and ksh) which had results other than bash. --steffen | |Der Kragenbaer,The moon be

Re: Question on $@ vs $@$@

2024-08-26 Thread Steffen Nurpmeso
whitespace characters is also treated as |> a delimiter. |> |> So this means that *regardless* of whatever $IFS is, the three IFS |> whitespace characters are $IFS anyway *if* that is set to |> a nin-empty non-default value. | |Nonsense. How you interpret this "also" if

Re: Question on $@ vs $@$@

2024-08-26 Thread Steffen Nurpmeso
Dear Robert, all. Robert Elz wrote in <39.1724620...@jacaranda.noi.kre.to>: |Date:Sun, 25 Aug 2024 04:08:58 +0200 |From:Steffen Nurpmeso |Message-ID: <20240825020858.nrX4pFTm@steffen%sdaoden.eu> | || (The only thinkable answer is that the step that my MUA does,

Re: Question on $@ vs $@$@

2024-08-26 Thread alex xmb sw ratchev
try ${@@Q} and ${*@Q} greets On Wed, Aug 14, 2024, 2:45 AM Steffen Nurpmeso wrote: > Hello. > > I include bug-bash even though i think bash is correct, but there > lots of people of expertise are listening, so, thus. > Sorry for cross-posting, nonetheless. > Given this snippet (twox() withou

Re: Question on $@ vs $@$@

2024-08-26 Thread Chet Ramey
On 8/24/24 11:49 PM, Lawrence Velázquez wrote: The bash manual says [1]: * ($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional parameter expands to a

Re: Question on $@ vs $@$@

2024-08-26 Thread Chet Ramey
On 8/23/24 5:47 PM, Steffen Nurpmeso wrote: If IFS has a value other than the default, then sequences of the whitespace characters space, tab, and newline are ignored at the beginning and end of the word, as long as the whitespace character is in the value of IFS (an IFS whitespace cha

Re: Question on $@ vs $@$@

2024-08-25 Thread Robert Elz
Date:Sun, 25 Aug 2024 04:08:58 +0200 From:Steffen Nurpmeso Message-ID: <20240825020858.nrX4pFTm@steffen%sdaoden.eu> | (The only thinkable answer is that the step that my MUA does, | namely resolving $* as a single string first, does not happen, | right? That's

Re: Question on $@ vs $@$@

2024-08-24 Thread Lawrence Velázquez
On Sat, Aug 24, 2024, at 11:49 PM, Lawrence Velázquez wrote: > Correct. Since you're using $* unquoted in a context where field > splitting is performed, the shell does not expand it to a single > field. That is, unless there's a single positional parameter that is not further split. -- vq

Re: Question on $@ vs $@$@

2024-08-24 Thread Lawrence Velázquez
On Sat, Aug 24, 2024, at 10:08 PM, Steffen Nurpmeso wrote: > One hopefully last thing in this regard for me, > > c() { echo "$# 1<$1> 2<$2> 3<$3> *<$*> @<$@>"; } This easily obfuscates the structure of the "$@" expansion. You'd be better off with something like this, which prints each positiona

Re: Question on $@ vs $@$@

2024-08-24 Thread Steffen Nurpmeso
Robert Elz wrote in <26326.1724474...@jacaranda.noi.kre.to>: |Date:Fri, 23 Aug 2024 23:47:06 +0200 |From:Steffen Nurpmeso |Message-ID: <20240823214706.oskn9OEF@steffen%sdaoden.eu> | || So IFS whitespace only if part of $IFS. | |That is the definition of IFS whi

Re: Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)

2024-08-24 Thread Steffen Nurpmeso
Greg Wooledge wrote in : |On Sat, Aug 24, 2024 at 02:15:48 +0200, Steffen Nurpmeso wrote: |> a() { |> echo $#,1=$1,2=$2,"$*",$*, |>} | |You didn't read a word I said, did you I recognize that i did not get your email even though i was in Cc:. |*Sigh.* --End of --steffen | |De

Re: Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)

2024-08-24 Thread Steffen Nurpmeso
Emanuele Torre wrote in : |On Sat, Aug 24, 2024 at 02:15:48AM +0200, Steffen Nurpmeso wrote: |> Sorry but i really have to come again, i do not understand what is |> going on, and *i* think shell is at fault. | |No. It is working correctly. | |> This: |> |> a() { |> echo $#,1=$1,2

Re: Question on $@ vs $@$@

2024-08-24 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in <20240825013311.B3Z3QcNn@steffen%sdaoden.eu>: |Robert Elz wrote in | <26326.1724474...@jacaranda.noi.kre.to>: ||Date:Fri, 23 Aug 2024 23:47:06 +0200 ||From:Steffen Nurpmeso ||Message-ID: <20240823214706.oskn9OEF@steffen%sdaoden.eu> ||

Re: Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)

2024-08-23 Thread Robert Elz
Date:Sat, 24 Aug 2024 02:33:26 +0200 From:Emanuele Torre Message-ID: | No. It is working correctly. It is indeed. | This $1 is unquoted, it will be split. You need to use "$1" if you don't | want it to split. Alternatively, make a() be a() {

Re: Question on $@ vs $@$@

2024-08-23 Thread Robert Elz
Date:Fri, 23 Aug 2024 23:47:06 +0200 From:Steffen Nurpmeso Message-ID: <20240823214706.oskn9OEF@steffen%sdaoden.eu> | So IFS whitespace only if part of $IFS. That is the definition of IFS whitespace. | So this "adjacent" even if *not* part of $IFS. No, only cha

Re: Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)

2024-08-23 Thread Greg Wooledge
On Sat, Aug 24, 2024 at 02:15:48 +0200, Steffen Nurpmeso wrote: > a() { > echo $#,1=$1,2=$2,"$*",$*, > } You didn't read a word I said, did you *Sigh.*

Re: Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)

2024-08-23 Thread Emanuele Torre
On Sat, Aug 24, 2024 at 02:15:48AM +0200, Steffen Nurpmeso wrote: > Sorry but i really have to come again, i do not understand what is > going on, and *i* think shell is at fault. No. It is working correctly. > > This: > > a() { > echo $#,1=$1,2=$2,"$*",$*, This $1 is unquoted, it will b

Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)

2024-08-23 Thread Steffen Nurpmeso
Sorry but i really have to come again, i do not understand what is going on, and *i* think shell is at fault. This: a() { echo $#,1=$1,2=$2,"$*",$*, } echo "$*"$* $*; a "$*"$* $* echo __ IFS=:;echo "$*"$* $*; a "$*"$* $*;unset IFS echo == set -- a b c echo "$*"$* $*; a "$*"$*

Re: Question on $@ vs $@$@

2024-08-23 Thread Steffen Nurpmeso
Greg Wooledge wrote in : |On Fri, Aug 23, 2024 at 01:28:49 +0200, Steffen Nurpmeso wrote: |> a() { echo $#,1=$1,2=$2,"$*",$*,; } |> set -- a b c |> echo 2 |> IFS=:; echo "$*"$*; a $* "$*"; I want to point out that bash in particular has the very dubious description in its manual page

Re: Question on $@ vs $@$@

2024-08-22 Thread Greg Wooledge
On Fri, Aug 23, 2024 at 01:28:49 +0200, Steffen Nurpmeso wrote: > a() { echo $#,1=$1,2=$2,"$*",$*,; } > set -- a b c > echo 2 > IFS=:; echo "$*"$*; a $* "$*"; Your printing function "a" is highly questionable. It's got unquoted word expansions that'll do who knows what, and it's also usin

Re: Question on $@ vs $@$@

2024-08-22 Thread Steffen Nurpmeso
Hello. Sorry for being here again, rather bash unrelated mostly.. Steffen Nurpmeso wrote in <20240816215210.PMy3rwiy@steffen%sdaoden.eu>: |Steffen Nurpmeso wrote in | <20240816212216.accse4FG@steffen%sdaoden.eu>: ||Robert Elz wrote in || <16443.1723841...@jacaranda.noi.kre.to>: |||Date:

Re: Question on $@ vs $@$@

2024-08-16 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in <20240816212216.accse4FG@steffen%sdaoden.eu>: |Hello kre@. | |Robert Elz wrote in | <16443.1723841...@jacaranda.noi.kre.to>: ||Date:Thu, 15 Aug 2024 23:33:42 +0200 ||From:Steffen Nurpmeso ||Message-ID: <20240815213342.t6-hdjZT@steffen%

Re: Question on $@ vs $@$@

2024-08-16 Thread Steffen Nurpmeso
Hello kre@. Robert Elz wrote in <16443.1723841...@jacaranda.noi.kre.to>: |Date:Thu, 15 Aug 2024 23:33:42 +0200 |From:Steffen Nurpmeso |Message-ID: <20240815213342.t6-hdjZT@steffen%sdaoden.eu> | || I have extended the test a bit, and i also see word split || dif

Re: Question on $@ vs $@$@

2024-08-16 Thread Robert Elz
Date:Thu, 15 Aug 2024 23:33:42 +0200 From:Steffen Nurpmeso Message-ID: <20240815213342.t6-hdjZT@steffen%sdaoden.eu> | I have extended the test a bit, and i also see word split | differences. There are so many problems with this test, that I'm not sure it is worth

Re: Question on $@ vs $@$@

2024-08-15 Thread Steffen Nurpmeso
One more, please. (And please excuse this still copies bug-bash.) Steffen Nurpmeso wrote in <20240815184858.r5T_UQnM@steffen%sdaoden.eu>: |Steffen Nurpmeso wrote in | <20240814200534.Vh3Eu_Md@steffen%sdaoden.eu>: ||Chet Ramey wrote in || <1bba673e-5ab9-4263-9d88-124854793...@case.edu>: |||On

Re: Question on $@ vs $@$@

2024-08-15 Thread Steffen Nurpmeso
Hello. Unfortunately i have to add one thing to this thread.. Steffen Nurpmeso wrote in <20240814200534.Vh3Eu_Md@steffen%sdaoden.eu>: |Chet Ramey wrote in | <1bba673e-5ab9-4263-9d88-124854793...@case.edu>: ||On 8/13/24 8:45 PM, Steffen Nurpmeso wrote: ||> I include bug-bash even though i thi

Re: Question on $@ vs $@$@

2024-08-15 Thread Marc Chantreux
On Wed, Aug 14, 2024 at 09:23:49AM -0400, Greg Wooledge wrote: > The most obvious would be to treat "$@$@" as if it were "$@" "$@", > generating exactly two words for each positional parameter. > > Thanks for this. My two cents: if I want "$@" "$@", i write it litterally. "$@$@" kinda

Re: Question on $@ vs $@$@

2024-08-14 Thread Steffen Nurpmeso
Hello. I only respond to this to reduce the noise. Chet Ramey wrote in <1bba673e-5ab9-4263-9d88-124854793...@case.edu>: |On 8/13/24 8:45 PM, Steffen Nurpmeso wrote: |> I include bug-bash even though i think bash is correct, but there |> lots of people of expertise are listening, so, thus. |>

Re: Question on $@ vs $@$@

2024-08-14 Thread Chet Ramey
On 8/13/24 8:45 PM, Steffen Nurpmeso wrote: Hello. I include bug-bash even though i think bash is correct, but there lots of people of expertise are listening, so, thus. Sorry for cross-posting, nonetheless. Given this snippet (twox() without argument it is) one() { echo "$# 1<$1>"; } two

Re: Question on $@ vs $@$@

2024-08-14 Thread Greg Wooledge
On Wed, Aug 14, 2024 at 17:58:15 +0300, Oğuz wrote: > On Wed, Aug 14, 2024 at 5:23 PM Robert Elz wrote: > > However, as ksh93 makes "" from this > > expansion, and so probably ksh88 might have done as well > > No, both Sun and SCO variants expand "$@$@" to zero fields when $# is 0. HP-UX 10.20 a

Re: Question on $@ vs $@$@

2024-08-14 Thread Oğuz
On Wed, Aug 14, 2024 at 5:23 PM Robert Elz wrote: > However, as ksh93 makes "" from this > expansion, and so probably ksh88 might have done as well No, both Sun and SCO variants expand "$@$@" to zero fields when $# is 0.

Re: Question on $@ vs $@$@

2024-08-14 Thread Robert Elz
Date:Wed, 14 Aug 2024 09:23:49 -0400 From:Greg Wooledge Message-ID: | The most obvious would be to treat "$@$@" as if it were "$@" "$@", That would clearly be wrong when there are positional parameters. | As a human trying to read this expression and figure out

Re: Question on $@ vs $@$@

2024-08-14 Thread Robert Elz
Date:Wed, 14 Aug 2024 11:04:08 +0200 From:Marc Chantreux Message-ID: | I'm really currious: do you see another one ? The case he was asking about is when $# is 0 (no positional params set) and whether "$@$@" should result in "" (1 arg) or nothing (0 args). Upon r

Re: Question on $@ vs $@$@

2024-08-14 Thread Greg Wooledge
On Wed, Aug 14, 2024 at 11:04:08 +0200, Marc Chantreux wrote: > > We know what "$@" is supposed to do. And something like "x${@}y" is > > well-defined also -- you simply prefix "x" to the first word, and append > > "y" to the final word. > > > But I don't know how "$@$@" is supposed to be interpr

Re: Question on $@ vs $@$@

2024-08-14 Thread Marc Chantreux
> We know what "$@" is supposed to do. And something like "x${@}y" is > well-defined also -- you simply prefix "x" to the first word, and append > "y" to the final word. > But I don't know how "$@$@" is supposed to be interpreted. I do not see > anything in the official wording that explains how

Re: Question on $@ vs $@$@

2024-08-14 Thread Oğuz
On Wednesday, August 14, 2024, Steffen Nurpmeso wrote: > > one() { echo "$# 1<$1>"; } > two() { one "$@"; } > twox() { one "$@$@"; } > two > two x > twox > twox x > $ dash shbug.sh > 0 1<> > 1 1 > 1 1<> > 1 1 > #?0|kent:tmp$ bash shbug.sh > 0 1<> > 1 1 > 0 1<>

Re: Question on $@ vs $@$@

2024-08-13 Thread Greg Wooledge
) > > one() { echo "$# 1<$1>"; } > two() { one "$@"; } > twox() { one "$@$@"; } > two > two x > twox > twox x So... what's the question? You didn't actually ask anything. As far as I can tell from the bash man page, &qu

Re: Question on $@ vs $@$@

2024-08-13 Thread alex xmb sw ratchev
On Wed, Aug 14, 2024, 02:45 Steffen Nurpmeso wrote: > Hello. > > I include bug-bash even though i think bash is correct, but there > lots of people of expertise are listening, so, thus. > Sorry for cross-posting, nonetheless. > Given this snippet (twox() without argument it is) > > one() { echo

Question on $@ vs $@$@

2024-08-13 Thread Steffen Nurpmeso
Hello. I include bug-bash even though i think bash is correct, but there lots of people of expertise are listening, so, thus. Sorry for cross-posting, nonetheless. Given this snippet (twox() without argument it is) one() { echo "$# 1<$1>"; } two() { one "$@"; } twox() { one "$@$@"; } two

Re: Question that baffles AI (all of them)

2024-06-15 Thread Greg Wooledge
ot; hobbit:~$ ./foo list item 0 is <1,2,3,4> list item 1 is <5,6,7> Similar packages probably exist in all of the major scripting languages that are not shells. I've Cc'ed help-bash for this; that's where the question belongs.

Re: Question that baffles AI (all of them)

2024-06-15 Thread alex xmb sw ratchev
bash dat.sh.1 1,2,3,4 a 1 , b 2 a 3 , b 4 or u meant to equally split the args ? On Sat, Jun 15, 2024, 11:30 PM Saint Michael wrote: > in this code: > data="'1,2,3,4','5,6,7,8'" > > # Define the processing function > process() { > echo "There are $# arguments." > echo "They are: $@" >

Re: Question that baffles AI (all of them)

2024-06-15 Thread Lawrence Velázquez
ocal job="$1" > shift > local a="$1" > shift > local b="$1" > shift > local remaining="$*" > echo "Arg1: '$a', Arg2: '$b'" > } > process "$data" > > how can I get my (a) and (b) arguments right? > The length of both strings is unpredictable. > a="1,2,3,4" and b="5,6,7,8"" This question belongs on help-bash, not bug-bash. -- vq

Question that baffles AI (all of them)

2024-06-15 Thread Saint Michael
in this code: data="'1,2,3,4','5,6,7,8'" # Define the processing function process() { echo "There are $# arguments." echo "They are: $@" local job="$1" shift local a="$1" shift local b="$1" shift local remaining="$*" echo "Arg1: '$a', Arg2: '$b'" } process "$dat

Re: Question about monitor mode / ignoreeof / EOF read

2023-01-19 Thread Steffen Nurpmeso
Chet Ramey wrote in : |On 1/16/23 6:35 PM, Steffen Nurpmeso wrote: |> It turns out that the inner shell tries to set the process group |> (to the parent shell which no longer exists), then causing the |> interactive bash on the terminal to read an EOF next, and without |> ignoreeof set the in

Re: Question about monitor mode / ignoreeof / EOF read

2023-01-19 Thread Chet Ramey
On 1/16/23 6:35 PM, Steffen Nurpmeso wrote: It turns out that the inner shell tries to set the process group (to the parent shell which no longer exists), then causing the interactive bash on the terminal to read an EOF next, and without ignoreeof set the interactive shell then exits. (This hap

Question about monitor mode / ignoreeof / EOF read

2023-01-16 Thread Steffen Nurpmeso
Hello. I am sorry to be here again, and it rather is a question than a bug report. But i thought .. better than not. On the dash list a FreeBSD programmer reported some problem with the monitor mode of dash (it turned out a FreeBSD /bin/sh commit from 2014, ([cd60e2c67d52, sh: Allow enabling

Re: Suggestion/question

2022-07-03 Thread Akbarkhon Variskhanov
> Personally, I think this would be a nice improvement, though it does > lead to the question "how do you set $XDG_CONFIG_HOME before you read > bashrc, where environment variables are typically defined". I was thinking about it the other day. I think defining XDG_CONFIG_HOME a

Re: Suggestion/question

2021-06-03 Thread Chet Ramey
On 6/2/21 6:46 PM, Eli Schwartz wrote: The earliest available snapshot in bash's git repo is bash-1.14.7.tar.gz, at which point ~/.bashrc was already used. This is in 1994. Someone else might know if it was in use between 1989 and 1994. The current startup file scheme has been in place since t

Re: Suggestion/question

2021-06-02 Thread Eli Schwartz
t;. Assuming we don't care about the FHS, but do care about XDG... This was discussed a month ago in the following thread: https://lists.gnu.org/archive/html/bug-bash/2021-05/msg00093.html Personally, I think this would be a nice improvement, though it does lead to the question "how

Suggestion/question

2021-06-02 Thread jonasxavier--- via Bug reports for the GNU Bourne Again SHell
Hi. I would like to know why bash does not follow FHS 3.0 (Filesystem Hierarchy Standard) suggestions. FHS 3.0 says "... 3.8.2. Requirements ... If an application needs to create more than one dot filethen they should be placed in a subdirectory ..." Bash uses ~/.files instead of ~/.bash/files

Re: Question about case statement in Bash docs

2021-05-10 Thread Chet Ramey
On 5/10/21 10:40 AM, Andreas Schwab wrote: On Mai 10 2021, Chet Ramey wrote: Either way, quote removal happens, the double quotes are removed, and the characters between the double quotes are treated specially. POSIX doesn't mention quote removal either. Is that a bug? There is the parenthe

Re: Question about case statement in Bash docs

2021-05-10 Thread Andreas Schwab
On Mai 10 2021, Chet Ramey wrote: > Either way, quote removal happens, the double quotes are removed, and > the characters between the double quotes are treated specially. POSIX doesn't mention quote removal either. Is that a bug? There is the parenthetical remark "(which also describes the eff

Re: Question about case statement in Bash docs

2021-05-10 Thread Chet Ramey
On 5/10/21 10:23 AM, Andreas Schwab wrote: On Mai 10 2021, Greg Wooledge wrote: On Mon, May 10, 2021 at 09:12:33PM +1000, AlvinSeville7cf wrote: x=test case $x in "test") echo Y esac Pattern is quoted but no quote removal is performed according to docs. Quote removal

Re: Question about case statement in Bash docs

2021-05-10 Thread Andreas Schwab
On Mai 10 2021, Greg Wooledge wrote: > On Mon, May 10, 2021 at 09:12:33PM +1000, AlvinSeville7cf wrote: >>x=test >>case $x in >>"test") echo Y >>esac >> >>Pattern is quoted but no quote removal is performed according to docs. > > Quote removal is essential, because of the

Re: Question about case statement in Bash docs

2021-05-10 Thread Chet Ramey
On 5/10/21 7:12 AM, AlvinSeville7cf wrote: Hello! Let’s consider the following snippet from [1]Bash docs: case word in [ [(] pattern [| pattern]…) command-list ;;]… esac It is written that: Each pattern undergoes tilde expansion, parameter expansion, command substitution, and a

Re: Question about case statement in Bash docs

2021-05-10 Thread Greg Wooledge
On Mon, May 10, 2021 at 09:12:33PM +1000, AlvinSeville7cf wrote: >x=test >case $x in >"test") echo Y >esac > >Pattern is quoted but no quote removal is performed according to docs. Quote removal is essential, because of the way the empty string is matched: case $foo in

Question about case statement in Bash docs

2021-05-10 Thread AlvinSeville7cf
Hello! Let’s consider the following snippet from [1]Bash docs: case word in [ [(] pattern [| pattern]…) command-list ;;]… esac It is written that: Each pattern undergoes tilde expansion, parameter expansion, command substitution, and arithmetic expansion. But if it’s true why the

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-07 Thread Chet Ramey
On 8/6/20 10:11 AM, Ilkka Virta wrote: > On 6.8. 15:59, Chet Ramey wrote: >> On 8/6/20 8:13 AM, Ilkka Virta wrote: >>> I think they meant the case where all the files matching the given >>> beginning have a longer prefix in common. The shell expands that prefix to >>> the command line after asking

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-06 Thread Ilkka Virta
On 6.8. 15:59, Chet Ramey wrote: On 8/6/20 8:13 AM, Ilkka Virta wrote: I think they meant the case where all the files matching the given beginning have a longer prefix in common. The shell expands that prefix to the command line after asking to show all possibilities. Only if you set the "sho

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-06 Thread Chet Ramey
kups/da would then change into >>  >> $ zz /jidanni_backups/dan_home_bkp with below it the question >>  >> Display all 113 possibilities? (y or n) >> >> What happens if you have: >> dan_home-bkp, dan_home_nobkp, dan-home-bkp, dan-nohome-bkp, >> dan_nohome-bkp (etc

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-06 Thread Davide Brini
On Thu, 6 Aug 2020 15:13:30 +0300, Ilkka Virta wrote: > I think they meant the case where all the files matching the given > beginning have a longer prefix in common. The shell expands that prefix > to the command line after asking to show all possibilities. > > $ rm * > $ touch dan_home_bkp{

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-06 Thread Ilkka Virta
On 5.8. 22:21, Chris Elvidge wrote: On 05/08/2020 02:55 pm, Chet Ramey wrote: On 8/2/20 6:55 PM, 積丹尼 Dan Jacobson wrote: how about doing the expansion first, so entering $ zz /jidanni_backups/da would then change into >> $ zz /jidanni_backups/dan_home_bkp with below it the qu

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-05 Thread Chris Elvidge
/jidanni_backups/da would then change into >> $ zz /jidanni_backups/dan_home_bkp with below it the question >> Display all 113 possibilities? (y or n) What happens if you have: dan_home-bkp, dan_home_nobkp, dan-home-bkp, dan-nohome-bkp, dan_nohome-bkp (etc.) in /jidanni_backups/? Which do you ch

Re: Expand first before asking the question "Display all xxx possibilities?"

2020-08-05 Thread Chet Ramey
anni_backups/da would then change into > $ zz /jidanni_backups/dan_home_bkp with below it the question > Display all 113 possibilities? (y or n) Thanks for the suggestion. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita br

Expand first before asking the question "Display all xxx possibilities?"

2020-08-02 Thread 積丹尼 Dan Jacobson
question Display all 113 possibilities? (y or n)

Re: Question about help information for the printf command

2019-09-10 Thread Chet Ramey
On 9/9/19 10:45 PM, 2477441814 wrote: > Dear team, > > > when I invoke 'help printf' in terminal to view help manual, It shown me '%b > %q %(fmt)T' is an addition to printf(1) and printf(3), The online version of > bash manual from (http://www.gnu.org/software/bash/manual/bash.html) does > sam

Question about help information for the printf command

2019-09-10 Thread 2477441814
Dear team, when I invoke 'help printf' in terminal to view help manual, It shown me '%b %q %(fmt)T' is an addition to printf(1) and printf(3), The online version of bash manual from (http://www.gnu.org/software/bash/manual/bash.html) does samely describe. but from GNU coreutils 8.22 which ins

Re: A question about bash change for efficiency speedups in multibyte locales

2018-04-09 Thread Chet Ramey
On 4/3/18 9:23 PM, yangyajing wrote: > I don't think it should check for '[:',  but it should check if the > pattern is defined in the charclass even if the pattern does not have a > multibyte character. I'll add something so that the code only falls back to the single-byte matcher if there is a p

Re: A question about bash change for efficiency speedups in multibyte locales

2018-04-03 Thread yangyajing
I don't think it should check for '[:',  but it should check if the pattern is defined in the charclass even if the pattern does not have a multibyte character. when the pattern is one of the character classes defined in the POSIX standard such as xdigit, these two lines of code can indeed speed

Re: A question about bash change for efficiency speedups in multibyte locales

2018-04-03 Thread Chet Ramey
On 4/2/18 10:59 PM, yangyajing wrote: > Thanks for your reply. > > The two lines of code are as follows which in the xstrmatch() function in > bash-4.3/lib/glob/smatch.c: > >   if (mbsmbchar (string) == 0 && mbsmbchar (pattern) == 0) >     return (internal_strmatch ((unsigned char *)pattern, (un

  1   2   3   4   5   >