練習

最後更新: 2015-08-28

 

output n x n matrix

output:
1       2       3       4       5
6       7       8       9       10
11      12      13      14      15
16      17      18      19      20
21      22      23      24      25

answer

#!/bin/bash

n=0
for m in {1..25};do
        n=$(( $n + 1 ))
        if [[ $n -ge 6 ]];then
                echo ""
                n=1
        fi
        echo -e -n "$m\t"
don

 

 


# test ping and do something

_IP=192.168.88.1

ping -c 3 $_IP > /dev/null

if  [ x"$?" == x"0" ]
then
        echo "Can Ping $_IP"
fi

 

 

 

Creative Commons license icon Creative Commons license icon