/usr/share/fish/man/man1/if.1 is in fish-common 2.4.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | .TH "if" 1 "Sun Dec 11 2016" "Version 2.4.0" "fish" \" -*- nroff -*-
.ad l
.nh
.SH NAME
\fBif\fP -- conditionally execute a command
.PP
.SS "Synopsis"
.PP
.nf
\fBif\fP CONDITION; COMMANDS_TRUE\&.\&.\&.;
[\fBelse\fP \fBif\fP CONDITION2; COMMANDS_TRUE2\&.\&.\&.;]
[\fBelse\fP; COMMANDS_FALSE\&.\&.\&.;]
\fBend\fP
.fi
.PP
.SS "Description"
\fCif\fP will execute the command \fCCONDITION\fP\&. If the condition's exit status is 0, the commands \fCCOMMANDS_TRUE\fP will execute\&. If the exit status is not 0 and \fCelse\fP is given, \fCCOMMANDS_FALSE\fP will be executed\&.
.PP
You can use \fC\fCand\fP\fP or \fC\fCor\fP\fP in the condition\&. See the second example below\&.
.PP
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 will print \fCfoo\&.txt exists\fP if the file foo\&.txt exists and is a regular file, otherwise it will print \fCbar\&.txt exists\fP if the file bar\&.txt exists and is a regular file, otherwise it will print \fCfoo\&.txt and bar\&.txt do not exist\fP\&.
.PP
.PP
.nf
\fBif\fP \fBtest\fP -f foo\&.txt
\fBecho\fP foo\&.txt exists
\fBelse\fP \fBif\fP \fBtest\fP -f bar\&.txt
\fBecho\fP bar\&.txt exists
\fBelse\fP
\fBecho\fP foo\&.txt and bar\&.txt do not exist
\fBend\fP
.fi
.PP
.PP
The following code will print 'foo\&.txt exists and is readable' if foo\&.txt is a regular file and readable
.PP
.nf
\fBif\fP \fBtest\fP -f foo\&.txt
\fBand\fP \fBtest\fP -r foo\&.txt
\fBecho\fP 'foo\&.txt exists and is readable'
\fBend\fP
.fi
.PP
|