How to get exit status of program in fish shell

Fish

Fish Problem Overview


In the bash shell, I could echo $? to get the exit code of a program run on the cli. What is the equivalent in the fish shell? Can't seem to find this in the docs.

Fish Solutions


Solution 1 - Fish

According to the official Fish documentation, you can use the $status variable:

> ### How do I get the exit status of a command? > > Use the $status variable. This replaces the $? variable used in some other shells.

Categories

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDarc NawgView Question on Stackoverflow
Solution 1 - Fishuser000001View Answer on Stackoverflow