1

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'.

terdon
  • 242,166
  • 2
    There is no -n nor -z option for if. If you think -n in if [ -n something ] belongs to the syntax of if then you're wrong. It belongs to the syntax of [. There is man [ but note it describes a standalone [ command. [ in Bash is a builtin first, covered in man bash. In if [[ -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:29
  • Adding to the information from the duplicate target: Bash usually gives you three kinds of documentation: the help builtin command you can use in interactive shells (help if, help test), the man page (man bash) and the Texinfo documentation (try info bash if, info bash test). Though AFAICT none of them makes it easy to get the relation between the if keyword/construct and the -n/-z test options at a glance. – fra-san Apr 23 '21 at 09:57
  • @fra-san They are documented in section 6.4 of the Bash reference manual. – berndbausch Apr 23 '21 at 10:41

0 Answers0