bug-bash
[Top][All Lists]
Advanced

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

"Variation" in Command Substitution Behaviour


From: Geoff Hull
Subject: "Variation" in Command Substitution Behaviour
Date: Tue, 28 Feb 2017 03:23:43 +0000

I think the following is a bug, but I'm not really sure. I've checked the documentation for differences between old-style command substitution ( `...` ) and new-style ( $(...) ), and couldn't see anything that related to this problem.

Background

At my place of work, I use some loops with variables to generate a lot of aliases and functions. Our employees use these to modify variables, including their PATH, to change their environment for testing different versions of our Cobol products. When I made a recent change, some of the PATH modifications stopped working. (Before diving in to investigate the issue, I changed the aliases to functions to get things working again.)

Test Case

I have created a much simpler set of test aliases and functions to illustrate the issue and I have to admit it's a bit obscure.

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


I think I should be seeing this output:

Flintstones=wilma:bam-bam:fred
Rubbles=betty:pebbles:barney

Interestingly, if I run the function 'run_aliases' to run the assemble_famX aliases, then it all works fine.

Another change that also makes the assemble_fam2 alias work properly (apart from using backticks) is to write the assemble_fam2 alias on one line as:

alias assemble_fam2="barney; RUBBLES=betty:pebbles:\$RUBBLES"

Hopefully, you can use this information to see if there is a problem.

Cheers,
Geoff

Attachment: test_aliases
Description: Binary data


reply via email to

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