如何组合fish中多个命令的输出?

ide*_*n42 5 fish

假设我想将 to 命令的输出发送到另一个命令中。

cat a.txt && ls

我可以做这个:

fish -c "cat a.txt && ls" | another_command

但这看起来很笨重,有没有办法在不运行新实例的情况下做到这一点?

gle*_*man 6

使用begin...end

begin; cat a.txt; ls; end | another_command
Run Code Online (Sandbox Code Playgroud)

或带有空格

begin
    cat a.txt
    ls
end | another_command
Run Code Online (Sandbox Code Playgroud)