I am having a weird problem with bash scripts.
I have two scripts: vlan_menu and the other network_menu. network_menu sources vlan_menu and calls configure_v().
Inside vlan_menu, I do this:
function configure_v() {
TAG_V=66
str="team0."
newtag="$(echo ${str}${TAG_V})"
${SCRIPTS}/system_config -e ${newtag} ...
echo ${newtag} >&2
}
when I run vlan_menu and print the value of ${newtag}, Isee: "team0.66" which is what I want to see.
network_menu:
source vlan_menu
configure_v;
When I run network_menu, the output of the echo is: "team0. 66"
Why does this happen? Please help.
source vlan_menuandconfigure_v, then it should be posted as well. (see the answer why using command-substitution withechoto assign a concatenated string is wrong -- well, at least, totally unnecessary)