Lazy Evaluation in Bash
- by User1
Is there more elegant way of doing lazy evaluation than the following:
pattern='$x and $y'
x=1
y=2
eval "echo $pattern"
results:
1 and 2
It works but eval "echo ..." just feels sloppy and may be insecure in some way. Is there a better way to do this in Bash?