ubuntu shell编程笔记

时间:2022-10-12 01:59:24

and 命令

if  [   A  -a   B ]

then

else

fi

while [ ]

do

done

set command

set  these are parameters

$1

set

strings

str="A is a"

echo "$str"

a=30 b=15
echo `expr $a + $b`
echo `expr $a - $b`
echo `expr $a \* $b`
echo `expr $a / $b`
echo `expr $a % $b`

a=`expr $a+1`

The Internal Field Separator

IFS=:

set ":" as field separator S1:S2:...

break continue the same

function

# test function. test.sh

func()

{

echo $1

}

.  test.sh

func a b 1 3