Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux Note 6 Vim editor with Shell command script.

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Write a simple script

1. Declaration of the script

two。 Comments on the script

3. Script command

Receive the user's parameters

Determine the parameters of the user

Conditional test statements can be divided into four types:

File test statement

Logical test statement

Integer value comparison statement

String comparison statement.

The single branch structure of if conditional statement consists of if, then and fi keywords.

The double branch structure of if conditional statement is composed of if, then, else and fi keywords. It makes a condition matching judgment, and if it matches the condition, it executes the corresponding preset command; otherwise, it executes the default command in the case of mismatch, which is equivalent to the colloquial "if. Then... or... so..." .

The multi-branch structure of if conditional sentence is composed of if, then, else, elif and fi keywords. It makes multiple condition matching judgments, any of which will execute the corresponding preset command after the match is successful, which is equivalent to the colloquial "if. Then. Then." .

For conditional loop statement

The for loop statement allows the script to read multiple messages at once and then manipulate the information one by one. When there is a range of data to be processed, the for loop statement is perfect.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report