Skip to content

Commit a2d68ec

Browse files
committed
expr: Escape '$' characters
1 parent a631d7b commit a2d68ec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/uu/expr/src/syntax_tree.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ impl StringOp {
182182
('\\', false) => re_string.push(curr),
183183
_ => re_string.push_str(r"\^"),
184184
},
185+
'$' => {
186+
if prev_is_escaped || prev != '\\' {
187+
re_string.push_str(r"\$");
188+
} else {
189+
re_string.push('$');
190+
}
191+
}
185192
_ => re_string.push(curr),
186193
}
187194

tests/by-util/test_expr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,6 @@ mod gnu_expr {
770770
.stdout_only("3\n");
771771
}
772772

773-
#[ignore]
774773
#[test]
775774
fn test_bre11() {
776775
new_ucmd!()

0 commit comments

Comments
 (0)