diff --git a/src/modules/expression/literal/mod.rs b/src/modules/expression/literal/mod.rs index c023927a..321e602b 100644 --- a/src/modules/expression/literal/mod.rs +++ b/src/modules/expression/literal/mod.rs @@ -162,6 +162,9 @@ fn translate_escaped_string(string: String, is_str: bool) -> String { chars.next(); }, Some('$') => { + if is_str { + result.push('\\'); + } result.push('$'); chars.next(); }, diff --git a/src/std/env.ab b/src/std/env.ab index 55db8250..d955eec9 100644 --- a/src/std/env.ab +++ b/src/std/env.ab @@ -65,7 +65,7 @@ pub fun is_command(command: Text): Bool { /// Creates a prompt and returns the value. pub fun input(prompt: Text): Text { trust $ read -p "\${nameof prompt}" $ - return "\$REPLY" + return trust $ echo \$REPLY $ } /// Creates a prompt, hides any user input and returns the value. @@ -73,8 +73,8 @@ pub fun input_hidden(prompt: Text): Text { trust { $ read -s -p "\${nameof prompt}" $ $ echo "" >&2 $ + return $ echo \$REPLY $ } - return "\$REPLY" } /// Creates a confirm prompt (Yes/No), and returns true if the choice is Yes.