I want to learn more about the -n or -z option in IF condition,
I tried:
man if
man condition
don't know where I can getto the the manpage of 'IF condition'.
I want to learn more about the -n or -z option in IF condition,
I tried:
man if
man condition
don't know where I can getto the the manpage of 'IF condition'.
-n
nor-z
option forif
. If you think-n
inif [ -n something ]
belongs to the syntax ofif
then you're wrong. It belongs to the syntax of[
. There isman [
but note it describes a standalone[
command.[
in Bash is a builtin first, covered inman bash
. Inif [[ -n something ]]
-n
belongs to the syntax of[[
which is a keyword in Bash.[
and[[
are similar but not equivalent. – Kamil Maciorowski Apr 23 '21 at 09:29help
builtin command you can use in interactive shells (help if
,help test
), the man page (man bash
) and the Texinfo documentation (tryinfo bash if
,info bash test
). Though AFAICT none of them makes it easy to get the relation between theif
keyword/construct and the-n
/-z
test
options at a glance. – fra-san Apr 23 '21 at 09:57