Skip to content

OperationOf_if_for_while_etc #3

@linrio

Description

@linrio

SHELL Script

  1. if
#! /bin/bash

read -p "Please input your score: " a 
if ((a < 60)) ; then
    echo "You didn`t pass the exam."
else
    echo "good! You passed the exam."
fi
  1. elif
#! /bin/bash

read -p "Please input your score: " a 
if ((a < 60)) ; then
    echo "You didn`t pass the exam."
elif ((a > 60)) && ((a < 85)); then
    echo "Good! You passed the exam."
else
    echo "Very good! Your score is very high!"
fi

-lt ( < )(小于),-gt ( > )(大于),-le ( <= )(小于等于),-ge ( => )(大于等于),-eq ( = )(等于),-ne ( != )(不等于)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions