[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on $@ vs $@$@
From: |
Steffen Nurpmeso |
Subject: |
Re: Question on $@ vs $@$@ |
Date: |
Fri, 30 Aug 2024 00:36:22 +0200 |
User-agent: |
s-nail v14.9.25-599-g5c75a327b2 |
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.1724902914@jacaranda.noi.kre.to>:
| Date: Wed, 28 Aug 2024 02:03:54 +0200
| From: Steffen Nurpmeso <steffen@sdaoden.eu>
| 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, which
|| is a "documented bug" here i would say),
|| for the shell this would be: leading IFS whitespace,
|
|First, since you're concerned with your MUA, you can define whatever
|rules you like for this, there's nothing in any MUA spec I know of
|which requires anything like shell parsing/syntax/evaluation (with
|the possible exception of MH (nmh) and only because that actually
|uses the shell for everything other than the actual access to the
|messages, etc), so if you want, you get to do as you like.
|
|But if you're trying to emulate the shell rules, you should do
|it correctly, not just almost, or you'll confuse people. So
|above, "leading IFS whitespace" certainly.
|
|Further, if this reaches the end of the bytes subject to
|field splitting, you're done (this is the exit condition).
|
|| 2. pass by none-to-many non-IFS bytes, the "field data", then
||
|| 3.
|| a. if there is a non-IFS-whitespace character:
|| - delimit the field, even with empty "field data",
||
|| b. if there is a IFS-whitespace character:
|| - delimit the field only with non-empty "field data",
|
|No, you simply delimit the field. The field cannot be empty
|if the delimiter found is IFS whitespace, or you would have
|ignored that in the "skip leading IFS whitespace" above.
That is very true. (..We came here by trying to make sense from
the words as of the bash manual.)
|That is, unless that #1 skip ran out of data (in which case you
|don't get here) it must have ended at either a non-IFS character
|(so the field is not empty, at the very least that character is
|in it) or a non_IFS-whitespace character (empty fields are allowed).
|
|| 4. skip trailing (new leading) (IFS-) whitespace
|
|Just "goto 1" (or "repeat").
Yes.
|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 simple,
|because that shell wasted no code it could avoid.
Yes indeed, it is not messy at all. If it is clear what exactly
is in IFS and what is to be expanded and how.
--End of <12813.1724902914@jacaranda.noi.kre.to>
Thank you, Robert.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
- Re: Question on $@ vs $@$@, (continued)
- Re: Question on $@ vs $@$@, Greg Wooledge, 2024/08/22
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/23
- Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/26
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/26
- Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/27
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/27
- Re: Question on $@ vs $@$@, Robert Elz, 2024/08/27
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/27
- Re: Question on $@ vs $@$@, Robert Elz, 2024/08/28
- Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/29
- Re: Question on $@ vs $@$@,
Steffen Nurpmeso <=
- Re: Question on $@ vs $@$@, Robert Elz, 2024/08/24
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/24
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/24
- Re: Question on $@ vs $@$@, Lawrence Velázquez, 2024/08/24
- Re: Question on $@ vs $@$@, Lawrence Velázquez, 2024/08/24
- Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/26
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/26
- Re: Question on $@ vs $@$@, Robert Elz, 2024/08/25
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/26
Re: Question on $@ vs $@$@, alex xmb sw ratchev, 2024/08/26