Get the App
SLTechnology News&Howtos  ›  Servers  › 

Example Analysis of Mini Program programming with SHELL

Shulou Source: shulou.com Published: 2022-05-31 18:18:57 10月03日 Update

The purpose of this article is to share with you the content of an example analysis of SHELL programming Mini Program. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Shell script example: (find the sum of 1 to 100)

# vi qiuhe.sh

#! / bin/sh # symbol #! Used to tell the system that the following parameters are the program used to execute the document

Astat1 # defines variables

Sum=0

While [$a-le 100] # while loop where-le means less than or equal to

Do

((sum=sum+a))

((a=a+1))

Done

Echo $sum

Save exit after writing wq.

# chmod + x qiuhe.sh (add executable permissions)

Several relational operators are referenced in the drawings:

When executing the script, you can use the following two methods, with reference to the attached drawing.

This summation can also be realized in one sentence.

# echo | awk'{for (item1teri)

Tags: Commands programs variables loops selections documents conditions parameters forms values formats statements references controls examples information content processes states users Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Xiaomi Docker MySQL Microsoft