Shell Programming Foundation-3

1. while loop

Syntax structure: while condition; do……; done

1) Infinite loop

While:

p>

do

  command

  done

2) Endless loop

While 1

Do

  command

  done

2. Check the system load every 30s, if the system load is greater than 10, send an email

Share pictures

1) View system load commands

w

Uptime

2) The delimiter specified by awk -F can be a string

3) Every 30s, sleep 30

3. continue

Extract out of this loop and continue the loop

Share a picture

4. break

Jump out of the loop and end the loop

Share a picture

5. exit

Exit the script directly

Leave a Comment

Your email address will not be published.