Re: nofork command substitution bugs

2024-01-12 Thread Chet Ramey
On 1/12/24 1:06 PM, Oğuz wrote: Why would that be unexpected, since you're explicitly running something in the calling shell's context, with the expected side effects to that environment? I wasn't clear. This doesn't exit the shell bash-5.3$ exec foo bash: exec: foo: not found

Re: nofork command substitution bugs

2024-01-12 Thread Oğuz
On Fri, Jan 12, 2024 at 7:05 PM Chet Ramey wrote: > Nofork command substitution freezes the jobs list, because you don't > want jobs appearing and disappearing in the list while you're running > word expansion. If the jobs list is frozen, wait -n doesn't even try > wa

Re: nofork command substitution bugs

2024-01-12 Thread Chet Ramey
On 1/4/24 8:36 AM, Oğuz wrote: These bugs affect the development branch only. 1. `wait -n' doesn't work inside nofork command substitution. I think it should, or wait without `-n' shouldn't work either, or what works and what doesn't should be documented. Nofork com

Re: inconsistent handling of closing brace inside no-fork command substitution

2024-01-04 Thread Chet Ramey
On 1/3/24 4:36 PM, Martin Schulte wrote: I couldn't reproduce this with neither 5.1.4 nor 5.2.15 - in both cases ${ case } in }) echo uname; esac } results in bash: syntax error near unexpected token `)' https://lists.gnu.org/archive/html/bug-bash/2023-05/msg00042.html -- ``The lyf so shor

nofork command substitution bugs

2024-01-04 Thread Oğuz
These bugs affect the development branch only. 1. `wait -n' doesn't work inside nofork command substitution. I think it should, or wait without `-n' shouldn't work either, or what works and what doesn't should be documented. $ sleep 3 & sleep 1; echo ${| w

Re: inconsistent handling of closing brace inside no-fork command substitution

2024-01-03 Thread Kerin Millar
On Wed, 3 Jan 2024 22:36:34 +0100 Martin Schulte wrote: > Hello Oğuz! > > > See: > > > > $ ${ case } in }) echo uname; esac } > > Linux > > $ ${ case }x in }x) echo uname; esac } > > bash: command substitution: line 25: syntax error n

Re: inconsistent handling of closing brace inside no-fork command substitution

2024-01-03 Thread Martin Schulte
Hello Oğuz! > See: > > $ ${ case } in }) echo uname; esac } > Linux > $ ${ case }x in }x) echo uname; esac } > bash: command substitution: line 25: syntax error near unexpected token > `x' > bash: command substitution: line 25: `}x)' >

Re: inconsistent handling of closing brace inside no-fork command substitution

2024-01-03 Thread Chet Ramey
On 1/3/24 8:41 AM, Oğuz wrote: See: $ ${ case } in }) echo uname; esac } Linux $ ${ case }x in }x) echo uname; esac } bash: command substitution: line 25: syntax error near unexpected token `x' bash: command substitution: line 25: `}x)' $ ${ case

inconsistent handling of closing brace inside no-fork command substitution

2024-01-03 Thread Oğuz
See: $ ${ case } in }) echo uname; esac } Linux $ ${ case }x in }x) echo uname; esac } bash: command substitution: line 25: syntax error near unexpected token `x' bash: command substitution: line 25: `}x)' $ ${ case }x in \}x) echo uname; esac } Linu

Re: command substitution when timing grouped commands fails

2023-09-07 Thread Kerin Millar
gives a syntax error when using the $(...) form of > command substitution and timing grouped commands. > > However, Bash works correctly when using the `...` form of > command substitution. > > > Repeat-By: > > The 'time' built-in command can m

command substitution when timing grouped commands fails

2023-09-07 Thread hackerb9
) x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.2 Patch Level: 15 Release Status: release Description: Bash gives a syntax error when using the $(...) form of command substitution and timing grouped commands. However, Bash works correctly when using

Error handling with nofork command substitution

2023-08-22 Thread jm
Hi, With the new funsub syntax ${ cmd;} and ${| cmd;} that encourages returning the value of $REPLY to the caller, I've been thinking about an idiomatic way of doing error handling and propagation that may call for a new shell option or new type of funsub. So the idea is natural, when a function

Re: Alias in command substitution

2023-06-21 Thread Kerin Millar
On Wed, 21 Jun 2023 09:01:20 -0400 Greg Wooledge wrote: > On Wed, Jun 21, 2023 at 09:54:30AM +0100, Kerin Millar wrote: > > On Wed, 21 Jun 2023 14:11:28 +0530 > > LitHack wrote: > > > > > But why this not worked in zsh. > > > > I don't use zsh. A fairly plausible explanation would be that its

Re: Alias in command substitution

2023-06-21 Thread Greg Wooledge
On Wed, Jun 21, 2023 at 09:54:30AM +0100, Kerin Millar wrote: > On Wed, 21 Jun 2023 14:11:28 +0530 > LitHack wrote: > > > But why this not worked in zsh. > > I don't use zsh. A fairly plausible explanation would be that its alias > builtin ignores the request to declare an alias, if issued in a

Re: Alias in command substitution

2023-06-21 Thread Kerin Millar
On Wed, 21 Jun 2023 14:11:28 +0530 LitHack wrote: > But why this not worked in zsh. I don't use zsh. A fairly plausible explanation would be that its alias builtin ignores the request to declare an alias, if issued in a subshell. -- Kerin Millar

Re: Alias in command substitution

2023-06-21 Thread Kerin Millar
On Wed, 21 Jun 2023 13:40:56 +0530 LitHack wrote: > Normally declaring a alias inside the command substitution would not > reflect in main shell like > lithack@aura:~$ `alias l=ls` > lithack@aura:~$ l > l: command not found > But using this command . > lithac

Alias in command substitution

2023-06-21 Thread LitHack
Normally declaring a alias inside the command substitution would not reflect in main shell like lithack@aura:~$ `alias l=ls` lithack@aura:~$ l l: command not found But using this command . lithack@aura:~$ `alias l=ls;alias` lithack@aura:~$ l api Desktop Downloads Music

Re: nofork command substitution

2023-05-25 Thread Daniel Douglas
These are both very useful!

Re: nofork command substitution

2023-05-25 Thread Chet Ramey
On 5/25/23 1:19 PM, Robert Elz wrote: Date:Thu, 25 May 2023 10:17:01 -0400 From:Chet Ramey Message-ID: | a nofork command substitution is | '${' compound_list '}', you omitted the extra char there, not that it matters for the purpo

Re: nofork command substitution

2023-05-25 Thread Robert Elz
Date:Thu, 25 May 2023 10:17:01 -0400 From:Chet Ramey Message-ID: | a nofork command substitution is | '${' compound_list '}', you omitted the extra char there, not that it matters for the purpose here. | The difference, as you say, i

Re: nofork command substitution

2023-05-25 Thread Chet Ramey
On 5/25/23 8:13 AM, Robert Elz wrote: Note that ${C } is not a group - it is syntax that delimits a command substituition in a word, and what's in a command substitution is a list (which can contain groups, or be one, but isn't required to be). There's not any real difference.

Re: nofork command substitution

2023-05-25 Thread Chet Ramey
On 5/25/23 6:29 AM, Koichi Murase wrote: 2023年5月24日(水) 22:27 Chet Ramey : [...] Thanks for testing it. Thank you for all the explanations and clarifications. Both are valid, but don't get too fond of ${(command)} -- I'm going to remove it in favor of people using ${ (command); } if they wa

Re: nofork command substitution

2023-05-25 Thread Koichi Murase
grammar similar to the existing one for the Principle Of Least Astonishment or like that. I admit that what would be the POLA design could depend on the person, so we can discuss it. > What Chet is planning on removing is allowing the 'C' in the opening ${C > that indicates that this i

Re: nofork command substitution

2023-05-25 Thread Robert Elz
word position. Any other syntax that allows that to happen should be OK. What Chet is planning on removing is allowing the 'C' in the opening ${C that indicates that this is a command substitution, and not some other kind of expansion, will no longer have the case where C==

Re: nofork command substitution

2023-05-25 Thread Koichi Murase
2023年5月24日(水) 22:27 Chet Ramey : > > [...] > > Thanks for testing it. Thank you for all the explanations and clarifications. > Both are valid, but don't get too fond of ${(command)} -- I'm going to > remove it in favor of people using ${ (command); } if they want a subshell. Does that mean ${(co

Re: parsing command substitution inside parameter expansion in interactive shell

2023-05-24 Thread Chet Ramey
On 5/23/23 2:50 PM, Grisha Levit wrote: One more similar case when the parameter expansion is quoted: bash --norc -in <<<$'"${_+$("\n")}"' bash-5.2$ "${_+$(" bash: command substitution: line 2: unexpected EOF while looking for matching `&quo

Re: nofork command substitution

2023-05-24 Thread Chet Ramey
On 5/23/23 4:17 PM, Grisha Levit wrote: An interactive shell gets confused (PS1 shown instead of PS2) when using newline as the first character of the substitution: $ bash --norc -i <<<$'${\n:;}' bash-5.2$ ${ bash-5.2$ :;} Thanks for the report. Chet -- ``The lyf so short, the craft so long

Re: nofork command substitution

2023-05-24 Thread Chet Ramey
On 5/23/23 4:17 PM, Grisha Levit wrote: Things don't seem to work right with an empty funsub: bash --pretty-print <<<'${ }' ${ ; } It should allow the empty command substitution, like $(), and not add the `;' when it reconstitutes the text. -- ``The lyf so shor

Re: nofork command substitution

2023-05-24 Thread Chet Ramey
On 5/23/23 6:52 AM, Koichi Murase wrote: I really appreciate that the feature ${ command; } is finally implemented. I have a function that mimics the behavior of the nofork command substitution in my project. I changed the function to switch to use the new nofork command substitutions in new

Re: nofork command substitution

2023-05-23 Thread Grisha Levit
An interactive shell gets confused (PS1 shown instead of PS2) when using newline as the first character of the substitution: $ bash --norc -i <<<$'${\n:;}' bash-5.2$ ${ bash-5.2$ :;} Things don't seem to work right with an empty funsub: bash --pretty-print <<<'${ }' ${ ; } $ bash -c '${ }'

Re: parsing command substitution inside parameter expansion in interactive shell

2023-05-23 Thread Grisha Levit
On Mon, Mar 20, 2023 at 4:59 PM Chet Ramey wrote: > Thanks for the report. This is the same thing as > > https://lists.gnu.org/archive/html/bug-bash/2021-06/msg00115.html > > with the command substitution being embedded in the parameter expansion. One more similar case whe

Re: nofork command substitution

2023-05-23 Thread Koichi Murase
2023年5月16日(火) 2:35 Chet Ramey : > The latest devel branch push has the initial implementation of `nofork' > command substitution. The excerpt from the info manual describing it is > appended. > > Please test it out, and find the places I missed. Thanks. I really appreci

Re: nofork command substitution

2023-05-22 Thread Martijn Dekker
Op 22-05-2023 om 16:18 schreef Chet Ramey: I'd call that a bug. It's not how mksh documents this type of command substitution to work. ksh93 documents the parsing the same way. So it does, yet ksh93 also accepts omitting the ;. The only documentation of this is in the legacy chang

Re: nofork command substitution

2023-05-22 Thread Chet Ramey
n such cases, the value to be assigned needs to come from somewhere, and I can't really see a lot of benefit in using this indirect method of getting that value, rather that simply putting the somewhere directly in the word, instead of this command substitution, except in the most unlikely of

Re: nofork command substitution

2023-05-19 Thread Grisha Levit
This will be a very neat feature to have. One thing I'm excited about is the ability to cleanly perform assignments during prompt expansion (e.g. to capture information during PS0 or PS4 expansion). Something I suspect people will complain about is that this change makes some polyglot zsh/bash sc

Re: nofork command substitution

2023-05-19 Thread Chet Ramey
On 5/19/23 12:39 PM, alex xmb ratchev wrote: after ${| set -- 1 2 3 } , 1 2 3 are no more .. right ? ;} or space} to end .. ? The portion of the documentation I posted says: "the close brace must be in a position where a reserved word may appear (i.e., preceded by a command terminator s

Re: nofork command substitution

2023-05-19 Thread Chet Ramey
On 5/19/23 11:56 AM, alex xmb ratchev wrote: Command substitution is a word expansion; word expansions are performed on words; command substitution occurs as part of a word. That all seems self-evident. The only reason to mention it is the quirk required to have the close brace

Re: nofork command substitution

2023-05-19 Thread Chet Ramey
On 5/19/23 7:36 AM, alex xmb ratchev wrote: 'C ..' ' ..' '| ..' .. i dont get it The `C' is the result of how info renders @var, used to indicate meta- syntactic variables (COMMAND is another). In other formats, it would be more apparent that it's not a literal `C' and that it's like the `COM

Re: Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
On Fri, May 19, 2023, 22:08 Chet Ramey wrote: > I don't think this ever made it to the list. > > > -- Forwarded message -- > From: Chet Ramey > To: "Ángel" > Cc: chet.ra...@case.edu > Bcc: > Date: Wed, 17 May 2023 11:53:46 -0400 > Su

Fwd: Re: nofork command substitution

2023-05-19 Thread Chet Ramey
I don't think this ever made it to the list.--- Begin Message --- On 5/16/23 5:40 PM, Ángel wrote: On 2023-05-15 at 13:35 -0400, Chet Ramey wrote: There is an alternate form of command substitution: ${C COMMAND; } I find this description confusing, as it looks like a liter

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
On Fri, May 19, 2023, 21:11 Greg Wooledge wrote: > On Fri, May 19, 2023 at 06:35:50PM +0200, alex xmb ratchev wrote: > > so that i understand , > > > > var=${ awk ... } > > There's no reason to use this new thing if you're calling awk, because > awk is an external program. You might as well just

Re: nofork command substitution

2023-05-19 Thread Greg Wooledge
On Fri, May 19, 2023 at 06:35:50PM +0200, alex xmb ratchev wrote: > so that i understand , > > var=${ awk ... } There's no reason to use this new thing if you're calling awk, because awk is an external program. You might as well just use var=$( awk ... ) instead. Either way, you're going to for

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
mple > | assignment to REPLY. > > In such cases, the value to be assigned needs to come from somewhere, > and I can't really see a lot of benefit in using this indirect method > of getting that value, rather that simply putting the somewhere directly > in the word, instead o

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
tting the somewhere directly > in the word, instead of this command substitution, except in the most > unlikely of cases (like when REPLY is built up gradually, via a loop > gradually adding more text). > > | I envision a little more complexity than that; a ${| printf -v REPLY

Re: nofork command substitution

2023-05-19 Thread Robert Elz
o come from somewhere, and I can't really see a lot of benefit in using this indirect method of getting that value, rather that simply putting the somewhere directly in the word, instead of this command substitution, except in the most unlikely of cases (like when REPLY is built up gradually,

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
xpansions, command substitutions, arithmetic >> > expansion, tilde exbansion, and in bash and some other shells, brace >> > expansion) are all word expansions. All of them occur anywhere in a >> > shell "word", and I don't see this proposed new form as bein

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
no > names: > >| ${| read; } > > > > I'd have thought a more likely example would be > > > > ${| printf -v REPLY 'whatever format' arg... ; > > Maybe, and certainly possible, but a more likely use is just a simple > assignment t

Re: nofork command substitution

2023-05-19 Thread Chet Ramey
ion, and in bash and some other shells, brace expansion) are all word expansions. All of them occur anywhere in a shell "word", and I don't see this proposed new form as being any different. It's not. It's command substitution. The only oddity is that inside the nofork cmd s

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
t; >> as a reserved word would usually require. > > > > I had to read this a couple of times to figure out what it means. In > > particular "the word" isn't well-bound here. > > Command substitution is a word expansion; word expansions are performed on &g

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
On Fri, May 19, 2023, 14:55 Greg Wooledge wrote: > On Fri, May 19, 2023 at 02:25:15PM +0200, alex xmb ratchev wrote: > > On Fri, May 19, 2023, 13:54 Greg Wooledge wrote: > > > > > On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote: > > > > 'C ..' > > > > ' ..' > > > > '| ..' > > >

Re: nofork command substitution

2023-05-19 Thread Chet Ramey
means. In particular "the word" isn't well-bound here. Command substitution is a word expansion; word expansions are performed on words; command substitution occurs as part of a word. That all seems self-evident. The only reason to mention it is the quirk required to have the clo

Re: nofork command substitution

2023-05-19 Thread Chet Ramey
On 5/18/23 9:58 PM, Dale R. Worley wrote: Ángel writes: I suggest: There is an alternate form of command substitution: ${ COMMAND; } and clarify later the other variants in addition to a space: The character following the open brace must be a space, tab, newline, '(

Re: nofork command substitution

2023-05-19 Thread Greg Wooledge
On Fri, May 19, 2023 at 02:25:15PM +0200, alex xmb ratchev wrote: > On Fri, May 19, 2023, 13:54 Greg Wooledge wrote: > > > On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote: > > > 'C ..' > > > ' ..' > > > '| ..' > > > > > > .. i dont get it > > > > Yeah, the wording isn't ideal. I

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
On Fri, May 19, 2023, 14:25 alex xmb ratchev wrote: > > > On Fri, May 19, 2023, 13:54 Greg Wooledge wrote: > >> On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote: >> > 'C ..' >> > ' ..' >> > '| ..' >> > >> > .. i dont get it >> >> Yeah, the wording isn't ideal. I'd start it out l

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
On Fri, May 19, 2023, 13:54 Greg Wooledge wrote: > On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote: > > 'C ..' > > ' ..' > > '| ..' > > > > .. i dont get it > > Yeah, the wording isn't ideal. I'd start it out like this: > yea better .. ${ COMMAND; } > ${| COMMAND; } >

Re: nofork command substitution

2023-05-19 Thread Greg Wooledge
On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote: > 'C ..' > ' ..' > '| ..' > > .. i dont get it Yeah, the wording isn't ideal. I'd start it out like this: ${ COMMAND; } ${| COMMAND; } Execute COMMAND in the current execution environment The first form (where the c

Re: nofork command substitution

2023-05-19 Thread alex xmb ratchev
'C ..' ' ..' '| ..' .. i dont get it On Mon, May 15, 2023, 19:35 Chet Ramey wrote: > The latest devel branch push has the initial implementation of `nofork' > command substitution. The excerpt from the info manual describing it is > appended. &

Re: nofork command substitution

2023-05-19 Thread Robert Elz
less frills) and select, and so is a var name already more or less reserved for the shell's internal use (like OPTIND, OPTARG, IFS, ...) and was just used for the purpose. Personally I'd prefer if this kind of command substitution [On trailing \n] | Is that what you intend the code

Re: nofork command substitution

2023-05-18 Thread Dale R. Worley
he word" isn't well-bound here. Perhaps better is > The characters immediately following the close brace continue the word > that the command substitution is part of; the close brace need not be > followed by a shell metacharacter as a reserved word would usually > require. T

Re: nofork command substitution

2023-05-18 Thread Dale R. Worley
Ángel writes: > I suggest: > >> There is an alternate form of command substitution: >> >> ${ COMMAND; } > > and clarify later the other variants in addition to a space: > >> The character following the open brace must be a space, tab, >> n

Re: nofork command substitution

2023-05-16 Thread Ángel
On 2023-05-15 at 13:35 -0400, Chet Ramey wrote: > There is an alternate form of command substitution: > > ${C COMMAND; } I find this description confusing, as it looks like a literal 'C'. I suggest: > There is an alternate form of command substitution:

Re: nofork command substitution

2023-05-15 Thread Chet Ramey
On 5/15/23 2:54 PM, Oğuz İsmail Uysal wrote: On 5/15/23 9:51 PM, Chet Ramey wrote: Everything is shared between the comsub and its caller, with a couple of documented exceptions. So it's just like calling `fg' in the current execution environment, but capturing the output. Oh, okay then. Thanks

Re: nofork command substitution

2023-05-15 Thread Oğuz İsmail Uysal
On 5/15/23 9:51 PM, Chet Ramey wrote: Everything is shared between the comsub and its caller, with a couple of documented exceptions. So it's just like calling `fg' in the current execution environment, but capturing the output. Oh, okay then. Thanks. How about this?     $ declare -i x     $ y

Re: nofork command substitution

2023-05-15 Thread Chet Ramey
On 5/15/23 2:42 PM, Oğuz İsmail Uysal wrote: On 5/15/23 8:35 PM, Chet Ramey wrote: Please test it out     $ cat     ^Z     [1]+  Stopped cat     $ x=${ fg;}     foo     foo     <^C or ^D here>     $ declare -p x     declare -- x="cat"     $ Is this intended? So far

Re: nofork command substitution

2023-05-15 Thread Oğuz İsmail Uysal
On 5/15/23 8:35 PM, Chet Ramey wrote: Please test it out     $ cat     ^Z     [1]+  Stopped cat     $ x=${ fg;}     foo     foo     <^C or ^D here>     $ declare -p x     declare -- x="cat"     $ Is this intended?

nofork command substitution

2023-05-15 Thread Chet Ramey
The latest devel branch push has the initial implementation of `nofork' command substitution. The excerpt from the info manual describing it is appended. Please test it out, and find the places I missed. Thanks. Chet == There is an alternate form of command substitution:

Re: parsing command substitution inside parameter expansion in interactive shell

2023-03-25 Thread Grisha Levit
On Mon, Mar 20, 2023 at 4:59 PM Chet Ramey wrote: > Thanks, it's an easy fix to preserve the newline here. FWIW even with the latest fixes, this kind of nesting in a history entry still triggers ASAN: bash --norc -in <<<$'${_+$(\n \cP\en ' ERROR: AddressSanitizer: heap-buffer-overflow READ of s

Re: parsing command substitution inside parameter expansion in interactive shell

2023-03-20 Thread Chet Ramey
On 3/19/23 9:58 PM, Grisha Levit wrote: If a command substitution inside a parameter expansion has a command followed by a newline, bash prints an error message (though the command is parsed and saved in the history list correctly): Thanks for the report. This is the same thing as https

parsing command substitution inside parameter expansion in interactive shell

2023-03-19 Thread Grisha Levit
If a command substitution inside a parameter expansion has a command followed by a newline, bash prints an error message (though the command is parsed and saved in the history list correctly): bash --norc -in <<<$'${_+$(:\n)}\n!!' $ ${_+$(: bash: command substitution: line 3: u

Re: caller returns wrong line number in command substitution

2022-10-24 Thread Chet Ramey
lly equivalent, but has the effect of throwing away leading and trailing sequences of newlines, since those don't contribute to the command. (Your suspicion about the new command substitution parsing code having an effect here is correct.) So when we go to perform word expansion on the proce

Re: caller returns wrong line number in command substitution

2022-10-18 Thread Andrew Neff via Bug reports for the GNU Bourne Again SHell
Oops, my mistake. Got some terms mixed up a little there. Yes, every time I command substitution, I meant process substitution. So that release note for "Rewrote the command substitution" most likely nothing to do with this. From: Robert Elz Sen

Re: caller returns wrong line number in command substitution

2022-10-18 Thread Robert Elz
There are no command substitutions in any of your examples. A command substitution is what you get with $( ) (or if you really like obsolete syntax for some reason, ``). What you're showing is process substitution. This has nothing to do with whether or not there is an issue here that&#x

caller returns wrong line number in command substitution

2022-10-18 Thread Andrew Neff via Bug reports for the GNU Bourne Again SHell
call, but that is not the case now in a process substitution in bash 5.2 (test 5) [quote] c. Rewrote the command substitution parsing code to call the parser recursively and rebuild the command string from the parsed command. This allows better syntax checking and catches errors much earl

Re: Parse error of function definition with here doc in command substitution

2022-10-17 Thread Chet Ramey
On 10/16/22 12:45 PM, D630 wrote: Hi, In version `5.2.0(1)-rc2 (x86_64-pc-linux-gnu)` from Debian, this code ``` _=$( f1() {     c <<-!     ! } f2() {     : } ) ``` results in ``` bash: command substitution: line 15: syntax error near unexpected

Parse error of function definition with here doc in command substitution

2022-10-16 Thread D630
Hi, In version `5.2.0(1)-rc2 (x86_64-pc-linux-gnu)` from Debian, this code ``` _=$( f1() { c <<-! ! } f2() { : } ) ``` results in ``` bash: command substitution: line 15: syntax error near unexpected

Re: bash seems confused about it's state after unclosed single quotes in nested command substitution

2022-04-16 Thread Chet Ramey
) x86_64 GNU/Linux $ echo $BASH_VERSION 5.1.4(1)-release $ sleep $(expr 60 - $(date +%s')) ; date bash: command substitution: line 417: unexpected EOF while looking for matching `'' bash: command substitution: line 418: syntax error: unexpected end of file bash: unexpected EOF wh

Re: bash seems confused about it's state after unclosed single quotes in nested command substitution

2022-04-15 Thread Andreas Schwab
On Apr 15 2022, Martin Schulte wrote: > I would either have expected to get PS2 and no error messages after > entering the line starting with sleep That's what I get when trying this in 5.2-beta. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73

bash seems confused about it's state after unclosed single quotes in nested command substitution

2022-04-15 Thread Martin Schulte
mmand substitution: line 417: unexpected EOF while looking for matching `'' bash: command substitution: line 418: syntax error: unexpected end of file bash: unexpected EOF while looking for matching `)' $ At this point it looks as if bash has encountered the problem and thus not

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
yea sorry i accept it doesnt work .. On Sat, Feb 5, 2022, 22:31 Chet Ramey wrote: > On 2/5/22 3:54 PM, Alex fxmbsw7 Ratchev wrote: > > it would make the whole work at alias level > > alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) > > 1 2 3 4 5 > > works > > [i wish] > > We need an intervention here

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/5/22 3:54 PM, Alex fxmbsw7 Ratchev wrote: it would make the whole work at alias level alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) 1 2 3 4 5 works [i wish] We need an intervention here. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Lawrence Velázquez
> On Sat, Feb 5, 2022 at 9:46 PM Chet Ramey wrote: >> >> On 2/5/22 3:44 PM, Alex fxmbsw7 Ratchev wrote: >> > maybe ask about an shopt feature to enable straight alias expansion >> > when the aliases are following .. >> >> How would that, whatever it is, help you here? I think he wants an option t

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
meant in more reasonable complicated codes they are more useufl On Sat, Feb 5, 2022 at 9:54 PM Alex fxmbsw7 Ratchev wrote: > > it would make the whole work at alias level > alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) > 1 2 3 4 5 > works > [i wish] > > On Sat, Feb 5, 2022 at 9:46 PM Chet Ramey wr

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
it would make the whole work at alias level alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) 1 2 3 4 5 works [i wish] On Sat, Feb 5, 2022 at 9:46 PM Chet Ramey wrote: > > On 2/5/22 3:44 PM, Alex fxmbsw7 Ratchev wrote: > > On Sat, Feb 5, 2022 at 9:39 PM Alex fxmbsw7 Ratchev > > wrote: > >> > >> On Sa

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/5/22 3:44 PM, Alex fxmbsw7 Ratchev wrote: On Sat, Feb 5, 2022 at 9:39 PM Alex fxmbsw7 Ratchev wrote: On Sat, Feb 5, 2022 at 7:55 PM Chet Ramey wrote: On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: what about this viewing point aliases can start, $(('s, but not end... this is unlogic

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
On Sat, Feb 5, 2022 at 9:39 PM Alex fxmbsw7 Ratchev wrote: > > On Sat, Feb 5, 2022 at 7:55 PM Chet Ramey wrote: > > > > On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: > > > what about this viewing point > > > aliases can start, $(('s, but not end... this is unlogic > > > > Well, I don't know abou

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
On Sat, Feb 5, 2022 at 7:55 PM Chet Ramey wrote: > > On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: > > what about this viewing point > > aliases can start, $(('s, but not end... this is unlogic > > Well, I don't know about `unlogic' but there's an understanding deficit, > for sure. > > > > > alia

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 6:21 PM, Alex fxmbsw7 Ratchev wrote: it seems me here the data was used as var inside $(( not as alias That, at least, is right. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@ca

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: what about this viewing point aliases can start, $(('s, but not end... this is unlogic Well, I don't know about `unlogic' but there's an understanding deficit, for sure. alias -- \ p='printf %s\\n ' \ assign='assign=$(( ' begin='$(( ' \ for dat

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
ave that expectation? | but | | cat <<$( printf end ) | $( printf end ) | # here it should already end the heredoc parser No it shouldn't. The 2nd line there doesn't have enough spaces, they're not the same. i didnt continue the last line that matched

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 3:06 PM, Alex fxmbsw7 Ratchev wrote: it was my mind shell does it mean it wont ever get to be the regex /<<([^ \t\f\v\r\n;]+) that is, after << is parsed a read word till next space, no shell expansion logic of separated functional structures in the topic of flat data is overruling,

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
it seems me here the data was used as var inside $(( not as alias i tried d1 d2 d3 combination and didnt work On Sat, Feb 5, 2022 at 12:17 AM Alex fxmbsw7 Ratchev wrote: > > what about this viewing point > aliases can start, $(('s, but not end... this is unlogic > > alias -- \ > p='printf %s\\n '

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
what about this viewing point aliases can start, $(('s, but not end... this is unlogic alias -- \ p='printf %s\\n ' \ assign='assign=$(( ' begin='$(( ' \ for data in "1 + 2" do alias -- data="$d " p begin data )) done this works and results 3 its just, early bugs, unlogic :) On Sat, Feb 5, 202

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022, 23:12 Chet Ramey wrote: > On 2/4/22 2:56 PM, Alex fxmbsw7 Ratchev wrote: > > >>> by flat non lexical text parsing, excepts for quotes but then $( > logically > >>> expands, excepts: > >>> but imho the topic here is how far to expand shell stuff at this > position, > >>> howev

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Chet Ramey
On 2/4/22 2:56 PM, Alex fxmbsw7 Ratchev wrote: by flat non lexical text parsing, excepts for quotes but then $( logically expands, excepts: but imho the topic here is how far to expand shell stuff at this position, however factically its just needs to be a constant data separator Well, you'd c

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
not when read - though in this > example it is used immediately when it is read, so that also makes no > apparent difference - but giving examples where it does is easy). > That includes expanding command substitutions inside the here doc > text (which does not include the end word). Th

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Robert Elz
ference - but giving examples where it does is easy). That includes expanding command substitutions inside the here doc text (which does not include the end word). The $( printf leet ) produces "leet" on stdout, which replaces the command substitution text in the here doc, so cat reads

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022 at 8:56 PM Alex fxmbsw7 Ratchev wrote: > > On Fri, Feb 4, 2022 at 8:28 PM Chet Ramey wrote: > > > > On 2/4/22 2:23 PM, Alex fxmbsw7 Ratchev wrote: > > > > > > imho the example above should have resulted in error ')' > > > > it would execute cat a b ) with hello till

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022 at 8:28 PM Chet Ramey wrote: > > On 2/4/22 2:23 PM, Alex fxmbsw7 Ratchev wrote: > > > > imho the example above should have resulted in error ')' > > > it would execute cat a b ) with hello till $( then rather \n and a b > > ) > > > again, useless > > > espe

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022, 20:18 Chet Ramey wrote: > On 2/3/22 9:46 PM, Alex fxmbsw7 Ratchev wrote: > > > The case I had in question with the question about $( a b ) was this > > one... > > > > cat <<$( a b ) > > hello > > $( a b ) > > > > > > i think you

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Chet Ramey
On 2/3/22 9:46 PM, Alex fxmbsw7 Ratchev wrote: The case I had in question with the question about $( a b ) was this one...         cat <<$( a b )         hello         $( a b ) i think you are mis understanding the differencies here between shell expression parsing, an

  1   2   3   4   5   6   >