Skip to content

Weird command_not_found error on subshell #5588

@admirabilis

Description

@admirabilis

Fish will output an Unknown command error for each argument inside a subshell if the actual command is not found.

~> fish -c 'echs 1 2 3'
fish: Unknown command 'echs'
fish: Unknown command '1'
fish: Unknown command '2'
fish: Unknown command '3'
fish: 
echs 1 2 3
^

This error made me waste some time today because I was running fish -c from Ansible, and I thought there was a bug in my code that made each argument run in a subshell, while it was just the error output that was strange.

It doesn't try to run each argument as a command, though:

~> fish -c 'echs echo'
fish: Unknown command 'echs'
fish: Unknown command 'echo'
fish: 
echs echo
^

Behaviour on Fish 2.7.1 (well, I guess Unknown command 'echs' would be easier to understand):

fish: Unknown command 'echs 1 2 3'
fish: 
echs 1 2 3
^

Requested information:

~> fish --version
fish, versão 3.0.0

~> echo $version
3.0.0

~> uname -a
Linux laptop 4.15.0-36-generic \#39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

~> echo $TERM
xterm-256color

~> sh -c 'env HOME=$(mktemp -d) fish -c "echs 1 2 3"'
fish: Unknown command 'echs'
fish: Unknown command '1'
fish: Unknown command '2'
fish: Unknown command '3'
fish: 
echs 1 2 3
^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions