Good afternoon everyone,
I have the following problem with BASH:
If I run the following code:
var_echo="echo "
var_text="uno dos tres"
var_pipe=" | awk '{print \$2}' "
EJECUTAR=$($var_echo $var_text $var_pipe )
echo "$EJECUTAR"
#Result:
uno dos tres | awk '{print $2}'
It only shows me the characters stored in the variables without the "echo", but if I execute it in the following way it works
var_echo="echo "
var_text="uno dos tres"
EJECUTAR=$($var_echo $var_text | awk '{print $2}' )
echo "$EJECUTAR"
#Result:
dos
How can I make the pipe with awk work for me from the variable, I don't get the error.
From already thank you very much.
Greetings.
I can't understand why it takes the variable and shows it as text characters and doesn't execute the pipe with awk