diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 872518be7..d568e81bd 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -412,7 +412,12 @@ maybe_t pipe_or_redir_t::from_string(const wchar_t *buff) { consume(L'^'); result.fd = STDERR_FILENO; result.mode = redirection_mode_t::overwrite; - if (try_consume(L'^')) result.mode = redirection_mode_t::append; + if (try_consume(L'^')) { + result.mode = redirection_mode_t::append; + } else if (try_consume(L'&')) { + // This is a redirection to an fd. + result.mode = redirection_mode_t::fd; + } if (try_consume(L'?')) result.mode = redirection_mode_t::noclob; break; } diff --git a/tests/checks/features-nocaret5.fish b/tests/checks/features-nocaret5.fish new file mode 100644 index 000000000..0dc3c25f6 --- /dev/null +++ b/tests/checks/features-nocaret5.fish @@ -0,0 +1,2 @@ +#RUN: %fish --features no-stderr-nocaret -c 'ls /abavojijsdfhdsjhfuihifoisj ^&1' +# CHECK: ls: {{.*}}