3 ms·
It also works with dynamic names, if you need a slightly different entry point and don't want to risk conflicting with other function names: run_foo() { echo
by Izkata 5y ago
It also works with dynamic names, if you need a slightly different entry point and don't want to risk conflicting with other function names:
run_foo() { echo foo; }
run_bar() { echo bar; }
name=foo
run_$name
- hnlmorg 5y agoThis kind of thing terrifies me when I see it in in code -- particularly when it's something like `$VAR -flags` -- because my first thought is always > "what if that variable isn't set to whatever the developer is expecting it to be set? What random command will then be executed?" As an author of an alternative shell myself, I purposely removed this ability for that reason.