Given this code, it prints "abc_${var1}" but I want it to print "abc_def" but bash scripting has a lot of little details that I'm not aware of so hopefully someone can explain this behavior:
Shell scripts:
function main()
var1="def"
var2=$(get_val_sh ${another_var})
echo ${var2}
# I want to echo:
# abc_def
# instead, I get:
# abc_${var1}
function get_val_sh()
var3=call_python(get_val_py())
echo ${var3}
Python:
def get_val_py():
print "abc_${var1}"
The other thing is that if I directly return from a bash script (rather than calling Python), I do get the desired result (but I have to call python). Does it have something to do with print in Python returning a different kind of string than echo in bash? I don't even know how to check this.
To be clear, the following code gives the desired result though I have no idea why but can't be used because I need Python to give me the appropriate value:
function main()
var1="def"
var2=$(get_val_sh ${another_var})
echo ${var2}
# I want to echo:
# abc_def
# instead, I get:
# abc_${var1}
function get_val_sh()
echo "abc_${var1}"