Zshell special variable for previous command output

What is a special variable that stores previous command output in zshell? For example, if I did:

$ which zsh something 

Instead of copying the output of "something", is there a way to get the result using a special variable?

I know I could use $_ to get the previous command that was called, is there something similar?

+6
source share
1 answer

You can simply wrap $_ in $() to execute it again. I suppose,

 $ which zsh /bin/zsh $ echo $($_) /bin/zsh 

Not sure if there is a variable that contains this output without running the command again, though ...

+4
source

All Articles