.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "AND" "1" "Nov 13, 2025" "4.2" "fish-shell" .SH NAME and \- conditionally execute a command .SH SYNOPSIS .nf \fIPREVIOUS\fP\fB;\fP \fBand\fP \fICOMMAND\fP .fi .sp .SH DESCRIPTION .sp \fBand\fP is used to execute a command if the previous command was successful (returned a status of 0). .sp \fBand\fP statements may be used as part of the condition in an \fI\%while\fP or \fI\%if\fP block. .sp \fBand\fP does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the \fI\%$status\fP variable. .sp The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command. .SH EXAMPLE .sp The following code runs the \fBmake\fP command to build a program. If the build succeeds, \fBmake\fP\(aqs exit status is 0, and the program is installed. If either step fails, the exit status is 1, and \fBmake clean\fP is run, which removes the files created by the build process. .INDENT 0.0 .INDENT 3.5 .sp .EX make; and make install; or make clean .EE .UNINDENT .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fI\%or\fP command .IP \(bu 2 \fI\%not\fP command .UNINDENT .SH COPYRIGHT fish-shell developers .\" Generated by docutils manpage writer. .