AnonSec Team
Server IP : 161.35.85.9  /  Your IP : 216.73.216.209
Web Server : nginx/1.30.1
System : Linux cheapdeb-ams3 7.0.9+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 7.0.9-1 (2026-05-22) x86_64
User : root ( 0)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/share/java/../python-apt/../python3/../python/../java/../java/../python/../fish/man/man1/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /usr/share/java/../python-apt/../python3/../python/../java/../java/../python/../fish/man/man1/if.1
.\" Man page generated from reStructuredText
.\" by the Docutils 0.22.4 manpage writer.
.
.
.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 "IF" "1" "May 15, 2026" "4.7" "fish-shell"
.SH NAME
if \- conditionally execute a command
.SH SYNOPSIS
.nf
\fBif\fP \fICONDITION\fP\fB;\fP \fICOMMANDS_TRUE\fP \&...\fB;\fP
[\fBelse\fP \fBif\fP \fICONDITION2\fP\fB;\fP \fICOMMANDS_TRUE2\fP \&...\fB;\fP]
[\fBelse\fP\fB;\fP \fICOMMANDS_FALSE\fP \&...\fB;\fP]
\fBend\fP
.fi
.sp
.SH DESCRIPTION
.sp
\fBif\fP will execute the command \fBCONDITION\fP\&. If the condition\(aqs exit status is 0, the commands \fBCOMMANDS_TRUE\fP will execute.  If the exit status is not 0 and else \%<> is given, \fBCOMMANDS_FALSE\fP will be executed.
.sp
You can use not \%<>, and \%<> or or \%<> in the condition. See the second example below.
.sp
The exit status of the last foreground command to exit can always be accessed using the $status \%<#\:variables-status> variable.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SH EXAMPLE
.sp
The following code will print \fBfoo.txt exists\fP if the file foo.txt exists and is a regular file, otherwise it will print \fBbar.txt exists\fP if the file bar.txt exists and is a regular file, otherwise it will print \fBfoo.txt and bar.txt do not exist\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-f foo.txt
    echo foo.txt exists
else if test \-f bar.txt
    echo bar.txt exists
else
    echo foo.txt and bar.txt do not exist
end
.EE
.UNINDENT
.UNINDENT
.sp
The following code will print \(dqfoo.txt exists and is readable\(dq if foo.txt is a regular file and readable
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-f foo.txt
   and test \-r foo.txt
   echo \(dqfoo.txt exists and is readable\(dq
end
.EE
.UNINDENT
.UNINDENT
.SH SEE ALSO
.sp
\fBif\fP is only as useful as the command used as the condition.
.sp
Fish ships a few:
.INDENT 0.0
.IP \(bu 2
test \- perform tests on files and text \%<> can compare numbers, strings and check paths
.IP \(bu 2
string \- manipulate strings \%<> can perform string operations including wildcard and regular expression matches
.IP \(bu 2
path \- manipulate and check paths \%<> can check paths for permissions, existence or type
.IP \(bu 2
contains \- test if a word is present in a list \%<> can check if an element is in a list
.UNINDENT
.SH Copyright
fish-shell developers
.\" End of generated man page.

AnonSec - 2021