lundi 15 juillet 2019

How to evaluate variable as binary expression in bash script

while doing some bash scripting I ran into a situation in which I wasn't really sure how to do something. How do I evaluate the entire contents of a string as a single expression inside of single if statement expression.

expression="0 != 1"
if [[ $expression ]]; then
     eval $action
     exit $?
fi

Aucun commentaire:

Enregistrer un commentaire