interpolate method
Substitutes $bash_vars in val
with values from env
.
Implementation
String interpolate(String val, Map<String, String?> env) =>
val.replaceAllMapped(_bashVar, (m) {
if ((m.group(1) ?? "") == "\\") {
return m.input.substring(m.start, m.end);
} else {
var k = m.group(3)!;
if (!_has(env, k)) return '';
return env[k]!;
}
});