Since eval might be considered evil, another more obscure solution would be to use arrays which are also supported by both shells. For example:
CMD=(date -u) "${CMD[@]}"
However, this will not work with dash, so the compromise is either to use eval which works almost everywhere or arrays which works on real shells.
Since eval might be considered evil, another more obscure solution would be to use arrays which are also supported by both shells. For example:
CMD=(date -u)
"${CMD[@]}"
However, this will not work with dash, so the compromise is either to use eval which works almost everywhere or arrays which works on real shells.