Performs conditional processing in shell scripts.
See also:test
,[
.
if {condition_command}; then {echo "Condition is true"}; fi
if ! {condition_command}; then {echo "Condition is true"}; fi
if {condition_command}; then {echo "Condition is true"}; else {echo "Condition is false"}; fi
if [[ -f {path/to/file} ]]; then {echo "Condition is true"}; fi
if [[ -d {path/to/directory} ]]; then {echo "Condition is true"}; fi
if [[ -e {path/to/file_or_directory} ]]; then {echo "Condition is true"}; fi
if [[ -n "${variable}" ]]; then {echo "Condition is true"}; fi
test
is an alias to [
; both are commonly used with if
):
man [
Copyright © 2014—present the tldr-pages team and contributors.
This work is licensed under the Creative Commons Attribution 4.0 International License (CC-BY).
=> CC-BY This content has been proxied by September (ba2dc).Proxy Information
text/gemini;lang=en-GB