Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created Nov 12, 2017
Embed
What would you like to do?
fish shell and manual pages
.TH "and" 1 "Mon Nov 13 2017" "Version 2.6.0" "fish" \" -*- nroff -*-
.ad l
.nh
.SH NAME
\fBand\fP - conditionally execute a command
.PP
.SS "Synopsis"
.PP
.nf
COMMAND1; \fBand\fP COMMAND2
.fi
.PP
.SS "Description"
\fCand\fP is used to execute a command if the current exit status (as set by the previous command) is 0\&.
.PP
\fCand\fP statements may be used as part of the condition in an \fC\fCif\fP\fP or \fC\fCwhile\fP\fP block\&. See the documentation for \fC\fCif\fP\fP and \fC\fCwhile\fP\fP for examples\&.
.PP
\fCand\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 \fC$status\fP variable\&.
.SS "Example"
The following code runs the \fCmake\fP command to build a program\&. If the build succeeds, \fCmake\fP's exit status is 0, and the program is installed\&. If either step fails, the exit status is 1, and \fCmake clean\fP is run, which removes the files created by the build process\&.
.PP
.PP
.nf
\fBmake\fP; \fBand\fP \fBmake\fP install; \fBor\fP \fBmake\fP clean
.fi
.PP
.TH "and" 1 "Mon Nov 13 2017" "Version 2.6.0" "fish" \" -*- nroff -*-
.ad l
.nh
.SH NAME
and \-
.SH "and - conditionally execute a command"
.PP
.SS "Synopsis"
.PP
.nf
COMMAND1; \fBand\fP COMMAND2
.fi
.PP
.SS "Description"
\fCand\fP is used to execute a command if the current exit status (as set by the previous command) is 0\&.
.PP
\fCand\fP statements may be used as part of the condition in an \fC\fCif\fP\fP or \fC\fCwhile\fP\fP block\&. See the documentation for \fC\fCif\fP\fP and \fC\fCwhile\fP\fP for examples\&.
.PP
\fCand\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 \fC$status\fP variable\&.
.SS "Example"
The following code runs the \fCmake\fP command to build a program\&. If the build succeeds, \fCmake\fP's exit status is 0, and the program is installed\&. If either step fails, the exit status is 1, and \fCmake clean\fP is run, which removes the files created by the build process\&.
.PP
.PP
.nf
\fBmake\fP; \fBand\fP \fBmake\fP install; \fBor\fP \fBmake\fP clean
.fi
.PP
.TH "and" 1 "Mon Nov 13 2017" "Version 2.6.0" "fish" \" -*- nroff -*-
.ad l
.nh
.SH NAME
and \-
.SH \fBand\fP - conditionally execute a command
.PP
.SS "Synopsis"
.PP
.nf
COMMAND1; \fBand\fP COMMAND2
.fi
.PP
.SS "Description"
\fCand\fP is used to execute a command if the current exit status (as set by the previous command) is 0\&.
.PP
\fCand\fP statements may be used as part of the condition in an \fC\fCif\fP\fP or \fC\fCwhile\fP\fP block\&. See the documentation for \fC\fCif\fP\fP and \fC\fCwhile\fP\fP for examples\&.
.PP
\fCand\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 \fC$status\fP variable\&.
.SS "Example"
The following code runs the \fCmake\fP command to build a program\&. If the build succeeds, \fCmake\fP's exit status is 0, and the program is installed\&. If either step fails, the exit status is 1, and \fCmake clean\fP is run, which removes the files created by the build process\&.
.PP
.PP
.nf
\fBmake\fP; \fBand\fP \fBmake\fP install; \fBor\fP \fBmake\fP clean
.fi
.PP
.TH "and" 1 "Mon Nov 13 2017" "Version 2.6.0" "fish" \" -*- nroff -*-
.ad l
.nh
.SH NAME
and \-
.SH and - conditionally execute a command
.PP
.SS "Synopsis"
.PP
.nf
COMMAND1; \fBand\fP COMMAND2
.fi
.PP
.SS "Description"
\fCand\fP is used to execute a command if the current exit status (as set by the previous command) is 0\&.
.PP
\fCand\fP statements may be used as part of the condition in an \fC\fCif\fP\fP or \fC\fCwhile\fP\fP block\&. See the documentation for \fC\fCif\fP\fP and \fC\fCwhile\fP\fP for examples\&.
.PP
\fCand\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 \fC$status\fP variable\&.
.SS "Example"
The following code runs the \fCmake\fP command to build a program\&. If the build succeeds, \fCmake\fP's exit status is 0, and the program is installed\&. If either step fails, the exit status is 1, and \fCmake clean\fP is run, which removes the files created by the build process\&.
.PP
.PP
.nf
\fBmake\fP; \fBand\fP \fBmake\fP install; \fBor\fP \fBmake\fP clean
.fi
.PP
.TH "and" 1 "Mon Nov 13 2017" "Version 2.6.0" "fish" \" -*- nroff -*-
.ad l
.nh
.SH NAME
\fBand\fP - conditionally execute a command
.PP
.SS "Synopsis"
.PP
.nf
COMMAND1; \fBand\fP COMMAND2
.fi
.PP
.SS "Description"
\fCand\fP is used to execute a command if the current exit status (as set by the previous command) is 0\&.
.PP
\fCand\fP statements may be used as part of the condition in an \fC\fCif\fP\fP or \fC\fCwhile\fP\fP block\&. See the documentation for \fC\fCif\fP\fP and \fC\fCwhile\fP\fP for examples\&.
.PP
\fCand\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 \fC$status\fP variable\&.
.SS "Example"
The following code runs the \fCmake\fP command to build a program\&. If the build succeeds, \fCmake\fP's exit status is 0, and the program is installed\&. If either step fails, the exit status is 1, and \fCmake clean\fP is run, which removes the files created by the build process\&.
.PP
.PP
.nf
\fBmake\fP; \fBand\fP \fBmake\fP install; \fBor\fP \fBmake\fP clean
.fi
.PP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment