diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index b62faf8a0b..889c8e7858 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -5103,7 +5103,7 @@ pub fn parse_expression( let split = name.splitn(2, |x| *x == b'='); let split: Vec<_> = split.collect(); - if split.len() == 2 && !split[0].is_empty() { + if !name.starts_with(b"^") && split.len() == 2 && !split[0].is_empty() { let point = split[0].len() + 1; let lhs = parse_string_strict( diff --git a/tests/shell/pipeline/commands/external.rs b/tests/shell/pipeline/commands/external.rs index 03c1053615..fd50fceb94 100644 --- a/tests/shell/pipeline/commands/external.rs +++ b/tests/shell/pipeline/commands/external.rs @@ -71,6 +71,13 @@ fn correctly_escape_external_arguments() { assert_eq!(actual.out, "$0"); } +#[test] +fn escape_also_escapes_equals() { + let actual = nu!(cwd: ".", r#"^MYFOONAME=MYBARVALUE"#); + + assert!(actual.err.contains("executable was not found")); +} + #[test] fn execute_binary_in_string() { let actual = nu!(