test: go into '[' mode when executable ends with [

This makes [ work even when installed with a custom prefix, e.g. as uu-[.
This commit is contained in:
Michael Debertol 2021-06-29 00:13:04 +02:00
parent 97d14893a1
commit cd83aed89c

View file

@ -31,7 +31,7 @@ pub fn uumain(mut args: impl uucore::Args) -> i32 {
let mut args: Vec<_> = args.collect();
// If invoked via name '[', matching ']' must be in the last arg
if binary_name == "[" {
if binary_name.ends_with('[') {
let last = args.pop();
if last != Some(OsString::from("]")) {
eprintln!("[: missing ']'");