[Top][All Lists]

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

4.2 error: processing command substitution within arithmetic operation

From: Rui Santos
Subject: 4.2 error: processing command substitution within arithmetic operation
Date: Fri, 24 Jun 2011 18:18:08 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; pt-PT; rv: Gecko/20100608 SUSE/3.1.0 Thunderbird/3.1

 Hi all,

This is my first post to this mailing list. If I'm doing anything that is not right, please do let me know.

While upgrading my company's Linux distribution, I also upgrade Bash to version 4.2-10, and found a glitch, that I consider a BUG. However I might be doing something wrong. Here are the details:

Try this script:

declare -ax array
array[$(( $( echo -n 1001 ) - 1001 ))]=1

this will issue an error: line 6: 1001: command not found

If however the script is turned into:

declare -ax array
array[$(( `echo -n 1001` - 1001 ))]=1

it works perfectly.

The first script will run without any problems on bash-4.1-9
However if, on bash 4.2-10 (where the 1st script fails), you have a script like:
echo $(( $( echo -n 1001 ) - 1001 ))

it also works fine.

So, I compared subst.c files from bash-4.1-9 and bash-4.2-10 and was able to build a patch that it seems to make it work. So to all you Bash guru's, can this patch be applied with no extra consequences ?

Thanks for all your help,

Rui Santos

Attachment: bash.patch-11
Description: Text document

reply via email to

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