This supercedes #470 and includes #471.
This fixes some edge cases when passing an asterisk to an sh* interop call.
Before this fix mal would pass the string with any wildcard character converted to __STAR__ when passing to the subcommand.
For example `(sh* "ls *")` would become `ls __STAR__` when executed.
See the tests for examples of where this would fail to do what the user expects.
See also: https://github.com/chr15m/flk/issues/1
sh__STAR__) EVAL "${a1}" "${env}"
local output=""
local line=""
+ r="${ANON["${r}"]}"
+ r="${r//__STAR__/*}"
while read -r line || [ -n "${line}" ]; do
output="${output}${line}"$'\n'
- done < <(eval ${ANON["${r}"]})
+ done < <(eval "${r}")
_string "${output%$'\n'}"
return ;;
try__STAR__) EVAL "${a1}" "${env}"
(sh* "echo hello; echo foo; echo yes;")
;=>"hello\nfoo\nyes"
+
+(sh* "grep -oE '\[.*!\]' core.sh")
+;=>"[reset!]\n[swap!]"
+
+(sh* "ls cor*.sh")
+;=>"core.sh"