Shell Programming

1. Variable

A=8

echo $A

2. Passing parameters

echo “$0 $1 $2”

echo “$*”

echo “[email protected]”

echo “$#”

3. Operator

S=$[(2+3)*4]

4. Judgment

= String Compare

-lt less thanless than

-le less thanequal

-eq equals equal

-gt greater than great than

-ge greater than< span style="font-family: 宋体;">equalgreant than equal

-ne notequalnot equal

if [conditional judgment formula];then < /span>

Program

fi

5. Loop

for j in “[email protected]”

do

echo “The num is $j”

Done

for (( initial value;loop control conditions; variable changes))

do

Program

done

while [conditional judgment]

do

Program

done

Leave a Comment

Your email address will not be published.