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

Bash basic Command referenc

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

If

Syntax: help if

If COMMANDS; then COMMANDS; [elif COMMANDS; then COMMANDS;]... [else COMMANDS;] fi

File related:

1. If [- f file]: whether to ask the file (return false does not exist)

2. If [- d dir]: whether it is a directory

3. If [- e file]: whether the file (directory) exists

4. If [- r file]: whether it is readable

5. If [- w file]: whether it is writable

6. If [- x file]: whether it is executable

7. If [- s file]: whether it is an empty file

8. If [- S file]: whether it is a Socket file

Compare size (integer variable)

1. If [a-eq b]: whether it is equal or not

2. If [a-ne b]: whether it is different or not

3. If [a-ge b]: greater than or equal to

4. If [a-gt b]: greater than

5. If [a-le b]: less than or equal to

6. If [a-lt b]: less than

String comparison

1. If [a = b]: whether it is equal

2. If [a! = b]: whether it is unequal

3. If [- n str]: non-empty

4. If [- z str]: empty

5. If [str]: non-empty, similar to-n

Logical operation (not yet verified)

1 、 if [! Exp]: not

2. If [!-d $dir]: directory does not exist

3. If [exp1-an exp2]: and

4. If [exp1-o exp2]: or

For

Syntax: help for

For ((exp1; exp2; exp3)); do COMMANDS; done

For NAME [in WORDS...]; do COMMANDS; done

Example:

For ((iTuno; I

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

Internet Technology

Wechat

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

12
Report