zoukankan      html  css  js  c++  java
  • [read -p应用]插拔光模块去检查port present状态

     1 #!/bin/bash
     2 path="/sys/devices/platform/soc/fd880000.i2c-pld/i2c-0/i2c-4/i2c-15/15-0060"
     3 arry=(module_interrupt module_present)#定义数组元素,可以扩展为多个,或仅为一个元素
     4 
     5 for f_log in ${arry[*]}
     6 do
     7 rm -rf $f_log*.log
     8 done
     9 
    10 
    11 for i in {1..32}
    12 do
    13 
    14         echo "#####################Start test port["$i"]##########################"
    15         echo "#cat $path/port"$i"_"${arry[0]}"" | tee -a  2>&1 ${arry[0]}.log 
    16         cat $path/port"$i"_"${arry[0]}" | tee -a  2>&1 ${arry[0]}.log 
    17 
    18         echo "#cat $path/port"$i"_"${arry[1]}"" | tee -a  2>&1 ${arry[1]}.log 
    19         cat $path/port"$i"_"${arry[1]}" | tee -a  2>&1 ${arry[1]}.log 
    20 
    21         sleep 1
    22         #提示字符串,拔出optical or loopback module,端口号以红颜色显示$i,31m
    23         read -t 30 -p "`echo -e "please unplug optical/loopback module 33[31m ["$i"] 33[0m"`...after that.Please press "Enter" key to continun":
    24         sleep 1
    25         echo "#cat $path/port"$i"_"${arry[0]}"" | tee -a  2>&1 ${arry[0]}.log 
    26         cat $path/port"$i"_"${arry[0]}"  | tee -a  2>&1 ${arry[0]}.log 
    27         
    28         echo "#cat $path/port"$i"_"${arry[1]}"" | tee -a  2>&1 ${arry[1]}.log 
    29         cat $path/port"$i"_"${arry[1]}"  | tee -a  2>&1 ${arry[1]}.log
    30  
    31         sleep 1
    32         #提示字符串,插回optical or loopback module,端口号以红颜色显示$i,31m
    33         read -t 30 -p "`echo -e "please plug back optical/loopback module.33[31m ["$i"] 33[0m"`..after that.Please press "Enter" key to continun"
    34         sleep 1
    35         echo "#cat $path/port"$i"_"${arry[0]}"" | tee -a  2>&1 ${arry[0]}.log 
    36         cat $path/port"$i"_"${arry[0]}"  | tee -a  2>&1 ${arry[0]}.log
    37          
    38         echo "#cat $path/port"$i"_"${arry[1]}"" | tee -a  2>&1 ${arry[1]}.log 
    39         cat $path/port"$i"_"${arry[1]}"  | tee -a  2>&1 ${arry[1]}.log 
    40         sleep 3
    41         
    42 done
  • 相关阅读:
    linux命令大全
    【转载】nginx的五种负载算法
    nginx服务器安装及配置文件详解
    查看linux系统核数
    利用nginx实现分流
    ntohs, ntohl, htons,htonl的比较和详解
    Nginx反向代理之HTTP 请求头中的 X-Forwarded-For
    javascript中 for in 、for 、forEach 、for of 、Object.keys().
    vue里面路由传参的三种方式
    vue中ref在input中详解
  • 原文地址:https://www.cnblogs.com/maisha/p/12186031.html
Copyright © 2011-2022 走看看