Writing shell script to print a certain number of lines with certain arguments

前端 未结 3 1920
傲寒
傲寒 2021-01-28 15:09

I have 5 variables and each variables contains five values.I want to print five lines with the five values from five variables one by one For example

$a=1 2 3 4          


        
3条回答
  •  余生分开走
    2021-01-28 15:31

    a="1 2 3 4 5"
    b="4 2 3 4 5"
    c="8 9 7 6 5"
    d="8 7 6 5 4"
    e="5 6 7 3 3"
    
    for i in $(seq 1 5); do
        echo -e "My options was \c"
        echo -e "a=$(echo $a | cut -f$i -d' ')\c"
        echo -e "b=$(echo $b | cut -f$i -d' ')\c"
        echo -e "c=$(echo $c | cut -f$i -d' ')\c"
        echo -e "d=$(echo $d | cut -f$i -d' ') and \c"
        echo -e "e=$(echo $e | cut -f$i -d' ')"
    done
    

提交回复
热议问题