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

3
  • 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. Commented Apr 23, 2021 at 9: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. Commented Apr 23, 2021 at 9:57
  • @fra-san They are documented in section 6.4 of the Bash reference manual. Commented Apr 23, 2021 at 10:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.