Timeline for Defer variable expansion to subshell
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2016 at 20:57 | comment | added | Petr Skocik |
@Dathan This does have gotchas. eval "$@" is essentially equivalent to eval "$*" as eval smushes all of its arguments together. You'll need to be careful with quoting and special characters in all arguments.
|
|
| Jun 20, 2016 at 20:32 | comment | added | Wouter Verhelst | Not really. Eval was created for just this purpose (evaluate variables in strings after defining the string). It can be a security issue in case you allow untrusted input to reach your eval; but given your premise, that's unlikely to be a problem. | |
| Jun 20, 2016 at 20:27 | comment | added | Dathan |
Thanks! That worked perfectly. Are there any edge cases that are likely to bite me by moving from '$@' to eval "$@"?
|
|
| Jun 20, 2016 at 20:26 | vote | accept | Dathan | ||
| Jun 20, 2016 at 20:06 | history | answered | Wouter Verhelst | CC BY-SA 3.0 |