Re: x[

2019-07-29 Thread Koichi Murase
> On 7/29/19 6:01 PM, Martijn Dekker wrote: > > Because that command is empty in this instance, bash does not bother to > > substitute a file name, and the <() is substituted by nothing. I didn't know this behavior. I tried several commands and found that if there is a space between ( and ), it is

Re: x[

2019-07-29 Thread Eli Schwartz
On 7/29/19 6:01 PM, Martijn Dekker wrote: > As others pointed out, it's the start of an array assignment, and > associative array indexes can contain newlines. Yeah, I think that was a bit of a retrospective lightbulb moment for a bunch of people on #bash > <(Process substitution) may look superf

Re: x[

2019-07-29 Thread Martijn Dekker
Op 29-07-19 om 19:09 schreef Eli Schwartz: The initial workaround discovered, was to use $ function _[ () { echo hello; }; <() _[ hello The use of <() somehow suppresses the glitch in the same way that quoting it does. If it were just glob expansion, then why should that be so? As others poin

Re: x[

2019-07-29 Thread Chet Ramey
On 7/29/19 12:55 PM, Isabella Bosia wrote: > haven't really looked into why this happens but x[ seems to trigger some > funny parser behavior > > x[ newline should not prompt with PS2 Yes, it should. It's the start of an array assignment, and an assignment statement is a valid part of a simpl

Re: x[

2019-07-29 Thread Stephane Chazelas
2019-07-29 17:55:58 +0100, Isabella Bosia: > haven't really looked into why this happens but x[ seems to trigger some > funny parser behavior > > x[ newline should not prompt with PS2 > > it can't be defined as a normal sh function, but it can be defined with the > function keyword [...] x[

Re: x[

2019-07-29 Thread Greg Wooledge
On Mon, Jul 29, 2019 at 01:09:28PM -0400, Eli Schwartz wrote: > On 7/29/19 1:01 PM, Clint Hepner wrote: > > The ``[`` begins a valid shell pattern, so the parser continues to > > accept input until the closing ``]`` is found. Pathname expansion > > (apparently) does not apply to the first "argument

Re: x[

2019-07-29 Thread Eli Schwartz
On 7/29/19 1:01 PM, Clint Hepner wrote: > The ``[`` begins a valid shell pattern, so the parser continues to > accept input until the closing ``]`` is found. Pathname expansion > (apparently) does not apply to the first "argument" of the > ``function`` command. The initial workaround discovered, w

Re: x[

2019-07-29 Thread Clint Hepner
> On 2019 Jul 29 , at 12:55 p, Isabella Bosia wrote: > > haven't really looked into why this happens but x[ seems to trigger some > funny parser behavior > > x[ newline should not prompt with PS2 > > it can't be defined as a normal sh function, but it can be defined with the > function k

Re: "${x-"$@"}" expansion

2016-05-01 Thread Chet Ramey
On 4/26/16 3:03 PM, Grisha Levit wrote: > This behavior seems very strange. This example is with $@ but it seems the > same for ${array[@]} > > The manual says for ${parameter:-word}: > >> If parameter is unset or null, the expansion of word is substituted. > > In this case, $@ is expanded as i

Re: "${x-"$@"}" expansion

2016-04-27 Thread Greg Wooledge
On Wed, Apr 27, 2016 at 07:33:25AM -0400, Grisha Levit wrote: > Sorry that wasn???t very clear. I only included that case to demonstrate that > seemingly contradictory things are happening: > >- "${_+$@}" expands each positional parameter to a separate word, >following the usual "$@" behav

Re: "${x-"$@"}" expansion

2016-04-27 Thread Grisha Levit
Sorry that wasn’t very clear. I only included that case to demonstrate that seemingly contradictory things are happening: - "${_+$@}" expands each positional parameter to a separate word, following the usual "$@" behavior - The usual "$@" behavior is to expand to 0 words if there are no

Re: "${x-"$@"}" expansion

2016-04-27 Thread Piotr Grzybowski
On 26 Apr 2016, at 21:03, Grisha Levit wrote: > This behavior seems very strange. This example is with $@ but it seems the > same for ${array[@]} > > The manual says for ${parameter:-word}: > > > If parameter is unset or null, the expansion of word is substituted. > > In this case, $@ is exp

Re: "${x-"$@"}" expansion

2016-04-26 Thread Grisha Levit
The same is true for + expansion: Multiple words: $ set -- 1 2; v=( "${#+$@}" ); declare -p v declare -a v=([0]="1" [1]="2") Empty string: $ set --; v=( "${#+$@}" ); declare -p v declare -a v=([0]="") Nothing: $ set --; v=( "${#+${#+$@}}" ); declare -p v declare -a v=()

Re: -x test always succeeds for root on Solaris

2011-01-05 Thread Chet Ramey
> Machine Type: i386-pc-solaris2.11 > > Bash Version: 4.1 > Patch Level: 9 > Release Status: release > > Description: > On Solaris 11, when root (as after 'su -' or from cron) uses bash's built-in > test to test for executability, it always succeeds, even when the file is > not executable.