shell args

    技术2025-10-08  4

    #!/bin/bash

    arr=$@;

     

    #echo ${arr[*]};

    arr1=(a b c);

    echo ${arr1[1]};

    echo ${arr[1]};

    #echo ${arr[1]};

    for x in $arr;

    do

     echo $x;

    done

    for xx in $arr1;

    do

     echo $xx;

    done

     

    echo "********";

    if (($#==0));

       then

         echo "none parameter";

     

    elif (($#>=2));

    then 

    tmp=$2;

    echo ${#tmp};

    echo $arr;

    if ((${#tmp}<4));

    then

     echo "the length of the parameter must be greater four";

    fi

    fi

     

     

    最新回复(0)