#! /bin/bash

#

for I in (1..10);do

    if [ $I -le 9 ];then

        echo -n "$RANDOM,"

    else

        echo "$RANDOM."

    fi

done

 

#! /bin/bash

#

declare -i MAX=0

MYRAND=$RANDOM

for I in (1..10);do

    if [ $I -le 9 ];then

        echo -n "$MYRAND,"

    else

        echo "$MYRAND."

    fi

    [$MYRAND -gt $MAX]&&MAX=$MYRAND

done

 

面向过程:

    控制结构

        顺序结构

        选择结构

        循环结构

选择结构

if:单分支,双分支,多分支

 

case语句:选择结构

case SWITCH in

value1)

    STATEMENT

    ...

    ;;

value2)

    STATEMENT

    ....

    ;;

*)

    statement

    ...

    ;;

esac