Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 1.46 KB

01-Conditional-Logic.md

File metadata and controls

80 lines (50 loc) · 1.46 KB

Conditional Logic

  • Lets understand Conditional-Logic

    Create and Launch Rocket

    • To Check the status of the rocket use below command:

      $ rocket-status lunar-mission
      
    • To debug the status of the rocket.

      $ rocket-debug lunar-mission
      

    cl

    Conditional Statement

    • if is defined as

      if [ $rocket_status = "failed" ]
      then
        rocket-debug $mission_name
      fi 
      

      if

    • elif condition is defined as

      if [ $rocket_status = "failed" ]
      then
        rocket-debug $mission_name
      elif [ $rocket_status = "success" ]
      then
        echo "This is successful"
      fi 
      

      elif

    • else is written as

      if [ -d "/home/bob/caleston" ]
      then
        echo "Directory exists"
      else
        echo "Directory not found"
      

      el

    Conditional Operators

    • Comparing statement can be used as:

      co

    • Conditional Operators that works in bash

      cb

    • AND and OR Operators

      cond

    • Conditional operation description

      cond1