diff --git a/doc_src/faq.hdr b/doc_src/faq.hdr index 0311cf442..3e8c605f9 100644 --- a/doc_src/faq.hdr +++ b/doc_src/faq.hdr @@ -86,6 +86,26 @@ end Use the `$status` variable. This replaces the `$?` variable used in some other shells. +\fish{cli-dark} +somecommand +if test $status -eq 7 + echo "That's my lucky number!" +end +\endfish + +If you are just interested in success or failure, you can run the command directly as the if-condition: + +\fish{cli-dark} +if somecommand + echo "Command succeeded" +else + echo "Command failed" +end +\endfish + +See the documentation for `test` and `if` for more information. + +Use the `fish_update_completions` command.
\section faq-single-env How do I set an environment variable for just one command?