void (@NotNull Map<String, String> envs, @NotNull Map<String, String> parentEnv) { LinkedHashMap<String, String> lookup = new LinkedHashMap<>(envs); lookup.putAll(parentEnv); for (Map.Entry<String, String> entry : envs.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (value != null) { Matcher matcher = pattern.matcher(value); while (matcher.find()) { String group = matcher.group(1); String expanded = lookup.get(group); if (expanded != null) { value = value.replace("$" + group + "$", expanded); } } envs.put(key, value); lookup.put(key, value); } } }