Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created November 12, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/3a6628ec121ce6c44594691a9be6282b to your computer and use it in GitHub Desktop.
Save shigemk2/3a6628ec121ce6c44594691a9be6282b to your computer and use it in GitHub Desktop.
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