Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread pepa65
On 28/01/2021 03.29, Léa Gris wrote: > Now if you want to preserve all the newlines you can use an ASCII EOF > character (formerly Ctrl + Z) that is unlikely to be part of a legit > string: > > a=$(printf $'hello\n\n\n\32'); a=${a%$'\32'}; declare -p a When doing this there is no subshell

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Chet Ramey
On 1/27/21 4:07 PM, Alex fxmbsw7 Ratchev wrote: thank you big time sir can you handle me the git cmd to get the sources with the fixes ? :)) Just fetch the devel branch. git clone --branch devel git://git.savannah.gnu.org/bash.git will probably work. You have to uncomment the fix. Search

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Alex fxmbsw7 Ratchev
thank you big time sir can you handle me the git cmd to get the sources with the fixes ? :)) /good night and thank you big time for your kind friendlyness On Wed, Jan 27, 2021, 22:01 Chet Ramey wrote: > On 1/27/21 3:37 PM, Alex fxmbsw7 Ratchev wrote: > > hm had it wrong memorized, maybe i was

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Chet Ramey
On 1/27/21 3:37 PM, Alex fxmbsw7 Ratchev wrote: hm had it wrong memorized, maybe i was working with a space instead of x there i sadly left all computer stuff since you didnt fix the three four major bugs i posted, since those stopped my coding wantings to 100% :( however i have a repost of

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Alex fxmbsw7 Ratchev
hm had it wrong memorized, maybe i was working with a space instead of x there i sadly left all computer stuff since you didnt fix the three four major bugs i posted, since those stopped my coding wantings to 100% :( however i have a repost of em ( no code isolationed cases since i only know the

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Chet Ramey
On 1/27/21 3:29 PM, Léa Gris wrote: Now if you want to preserve all the newlines you can use an ASCII EOF character (formerly Ctrl + Z) that is unlikely to be part of a legit string: a=$(printf $'hello\n\n\n\32'); a=${a%$'\32'}; declare -p a It doesn't matter what you use (besides a

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Léa Gris
Le 27/01/2021 à 21:21, Alex fxmbsw7 Ratchev écrivait : as well as one newline instead of x, it cuts afik _one_ ending nrwline, not all It removes every trailing newline a=$(printf $'hello\n\n\n'); declare -p a Now if you want to preserve all the newlines you can use an ASCII EOF character

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Chet Ramey
On 1/27/21 3:21 PM, Alex fxmbsw7 Ratchev wrote: as well as one newline instead of x, it cuts afik _one_ ending nrwline, not all No, command substitution removes all trailing newlines. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' -

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Greg Wooledge
On Wed, Jan 27, 2021 at 09:21:09PM +0100, Alex fxmbsw7 Ratchev wrote: > as well as one newline instead of x, it cuts afik _one_ ending nrwline, not > all If you mean command substitution, this is incorrect. Command substitution removes all trailing newlines.

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Alex fxmbsw7 Ratchev
as well as one newline instead of x, it cuts afik _one_ ending nrwline, not all On Wed, Jan 27, 2021, 21:01 Chet Ramey wrote: > On 1/27/21 12:08 AM, Oğuz wrote: > > What's wrong with printing an `x' at the end and removing it later? > > Nothing. > > -- > ``The lyf so short, the craft so long to

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Chet Ramey
On 1/27/21 12:08 AM, Oğuz wrote: What's wrong with printing an `x' at the end and removing it later? Nothing. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.edu

Re: . and .. are included where they were excluded before

2021-01-27 Thread Chet Ramey
On 1/27/21 4:07 AM, pepa65 wrote: On 27/01/2021 14.49, k...@plushkava.net wrote: That's why your .? glob doesn't match the .. pathname. Normally, GLOBIGNORE isn't set. After unsetting GLOBIGNORE: That doesn't unset GLOBIGNORE. $ declare -p GLOBIGNORE declare -x GLOBIGNORE="" Depending

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread pepa65
On 27/01/2021 16.07, Clark Wang wrote: > $(|cmd ...) makes more sense for me. '|' is a pipe which means passthrough. > > For future extensions, use > > $([=value1][=value2] cmd ...) > > For example, > > $(_trailing_newlines cmd ...) is just the same as $(|cmd ...). > $(_fork cmd ...)

Re: . and .. are included where they were excluded before

2021-01-27 Thread pepa65
On 27/01/2021 14.49, k...@plushkava.net wrote: > That's why your .? glob doesn't match the .. pathname. Normally, > GLOBIGNORE isn't set. After unsetting GLOBIGNORE: $ declare -p GLOBIGNORE declare -x GLOBIGNORE="" $ shopt -u extglob $ echo @(?|.?) -bash: syntax error near unexpected token `(' $

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Clark Wang
On Wed, Jan 27, 2021 at 4:40 PM Clark Wang wrote: > On Wed, Jan 27, 2021 at 12:14 PM Clark Wang wrote: > >> For example, we can use ${( ... )} which is now wrong syntax. >> >> $ v=${( command ... )} >> bash: ${( command ... )}: bad substitution >> > > Or keep it similar to $(cmd), like: > >

Re: RFE: new syntax for command substitution to keep trailing newlines?

2021-01-27 Thread Clark Wang
On Wed, Jan 27, 2021 at 12:14 PM Clark Wang wrote: > For example, we can use ${( ... )} which is now wrong syntax. > > $ v=${( command ... )} > bash: ${( command ... )}: bad substitution > Or keep it similar to $(cmd), like: $(& cmd ...) $(; cmd ...) $(| cmd ...)