bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Variation" in Command Substitution Behaviour


From: Geoff Hull
Subject: Re: "Variation" in Command Substitution Behaviour
Date: Wed, 1 Mar 2017 19:04:06 +1300

Hi Reuti, Andreas,

Yes, forgot to mention the bash versions I have tried: 4.3.46 on Arch Linux and 4.1.2 on CentOS 6.8.

This is getting weirder: I've found I can replicate the behaviour you are getting Reuti, if I first do this command:

unset COMMAND_PROMPT

If I want to go back to the behaviour I first experienced (i.e. Rubbles=barney after running assemble_fam1 then assemble_fam2), then I put the default COMMAND_PROMPT back:

PROMPT_COMMAND='printf "\033]0;address@hidden:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

Does this work the same for you?

Geoff


On 1 March 2017 at 02:21, Reuti <address@hidden> wrote:
Hi,

> Am 28.02.2017 um 11:00 schrieb Andreas Schwab <address@hidden>:
>
> On Feb 28 2017, Geoff Hull <address@hidden> wrote:
>
>> If I "source" the attached file (i.e. ". test_aliases") in a bash session,
>> then run the following:
>>
>> assemble_fam1
>> assemble_fam2
>> say_families
>>
>> I see the following output:
>>
>> Flintstones=wilma:bam-bam:fred
>> Rubbles=barney

In which version of Bash are you observing this? For me it's working using this order, but when I swap assemble_fam1 and assemble_fam2 I observe a strange behavior, that RUBBLES gets reset and I get your output:

$ assemble_fam1
$ assemble_fam2
$ say_families
Flintstones=wilma:bam-bam:fred
Rubbles=betty:pebbles:barney
$ reset_vars
$ assemble_fam2
$ say_families
Flintstones=
Rubbles=betty:pebbles:barney
$ assemble_fam1
$ say_families
Flintstones=wilma:bam-bam:fred
Rubbles=barney


This I have in 4.2 and 4.4.

$ reset_vars
+ reset_vars
+ unset FSTONES RUBBLES
$ assemble_fam2
+ barney
++ echo barney
+ RUBBLES=barney
$ say_families
+ RUBBLES=betty:pebbles:barney
+ say_families
+ echo Flintstones=
Flintstones=
+ echo Rubbles=betty:pebbles:barney
Rubbles=betty:pebbles:barney
$ assemble_fam1
+ fred
++ echo fred
+ FSTONES=fred
+ FSTONES=wilma:bam-bam:fred
$ say_families
+ say_families
+ echo Flintstones=wilma:bam-bam:fred
Flintstones=wilma:bam-bam:fred
+ echo Rubbles=barney
Rubbles=barney


> It seems like the shell is eating an extra newline.  Try typing an empty
> line after assemble_fam2:

The extra newline doesn't help for the observation above. While defining assemble_famX in one line for both does as mentioned by Geoff.

-- Reuti


reply via email to

[Prev in Thread] Current Thread [Next in Thread]