Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zshell special variable for previous command's output

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

$ which zsh
  something

Instead of copying the output 'something', is there a way to get the output by way of a special variable?

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

like image 280
user1684636 Avatar asked Feb 19 '13 08:02

user1684636


1 Answers

You could just wrap $_ in $() to execute it again I suppose

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

Not sure if there's a variable that holds that output without re-running the command though...

like image 57
bundacia Avatar answered Oct 18 '22 12:10

bundacia