2 ms·
`myeval` is more subtle. It is like eval but reliably escapes and evaluates the arguments as a single command. cmd 'hello '\'''\'''\'''\''"simon' 'thanks'
by mullikine 5y ago
`myeval` is more subtle.
It is like eval but reliably escapes and evaluates the arguments as a single
command.
cmd 'hello '\'''\'''\'''\''"simon' 'thanks' 'for' 'lunch'
# Output: 'hello '\'''\'''\'''\''"simon' 'thanks' 'for' 'lunch'
# The fact that myeval seems useless here is testament to its greatness
myeval cmd 'hello '\'''\'''\'''\''"simon' 'thanks' 'for' 'lunch'
# Output: 'hello '\'''\'''\'''\''"simon' 'thanks' 'for' 'lunch'
# eval isn't great though
eval cmd 'hello '\'''\'''\'''\''"simon' 'thanks' 'for' 'lunch'
# Error: zsh: unmatched "