< Shell Programming


The if statement has the following basic structure:

  if [ condition of expressions ]; then
  fi


Using && and || in control statements

The && and || can be used in control statements to represent nested loops like:

  if [ condition1 ]; then
     if [ condition 2 ]; then
     fi
  fi

as:

  if [ condition1 ] && [ condition2 ]; then
  fi
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.