How to get a fish shell exit status

In bash shell, could I echo $? get the exit code of a program running on cli. What is equivalent in a fish shell? It does not seem to be found in the docs.

+15
bash fish
source share
1 answer

According to this website https://fishshell.com/docs/current/faq.html#faq-exit-status you can use the $status variable:

How to get team exit status?

Use the $status variable. Does this replace the variable $? used in some other shells.

+19
source share

All Articles