|
From: | address@hidden |
Subject: | Execution of a data string |
Date: | Wed, 21 Sep 2016 23:15:45 -0400 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPA$ uname output: Linux ks 4.1.0-0.bpo.2-amd64 #1 SMP Debian 4.1.6-1~bpo8+1 (2015-09-09) x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 4.3 Patch Level: 30 Release Status: release _______________________________________________________________ You can see in the picture below that: declare -a "$ExecuteThisData" resulted in executing the string "$ExecuteThisData" without eval being explicitly invoked. I believe this is unintentional since this is a variable assignment: commands to reproduce above: ExecuteThisData='a=([$(expr 4 - 3)]=$(echo '1ne' | tr '1' 'o'))' b="$ExecuteThisData" echo "$b" echo "$ExecuteThisData" unset a declare -a "$ExecuteThisData" declare -p a echo ${a[1]} _______________________________________________________________ Note however that: { declare -a a="$Data" } : produces the expected result of assigning each space delimited element to a separate array element, and does not execute the data. _____________________________________________ In Summary: declare -a "$string" # results in execution of $string declare -a a=($string) # does not result in execution of $string I can't find the compiler version for bash but it is debian jessie's compiled version. Your response would be appreciated. Michael |
[Prev in Thread] | Current Thread | [Next in Thread] |