I am exporting variables from shell script to awk. The program is below
export name="hi"
eval $(awk '{element="bye";name=element"name";print name}')
echo $name
What is my expected output is I need to concatenate the name with element inside the awk script and then display the concatenated result outside and hence my output would be
name=byehi
But I am not getting the same. Could you ppl please help me regarding this. Thank you.
You can assign variables with the -v option without the need to export anything to the environment. For example:
This will return
byehias expected.