1 #!/bin/bash
2 #######################################################################
3 #Created by: Bing #
4 #Create time:11/11/2019 #
5 #Applied Project:xx #
6 #######################################################################
7 path="/sys/devices/platform/soc/fd8be100.spi_aux/spi_master/spi1/spi1.0/i2c-34"
8 arry=(vendor_name vendor_part_num vendor_revision_num vendor_serial_num ) #定义数组arry,数组元素以空格分开
9
10 for f_log in ${arry[*]} #以数组元素名为进行循环,作为保存的log名
11 do
12 rm -rf $f_log*.log #在执行脚本前,删除已有的log
13 done
14
15 for i in ${arry[*]} #循环执行数组元素
16 do
17 for ((j=37;j<=66;j++)) #分别对port 37-66进行循环
18 do
19 echo "#cat $path/i2c-$j/$j-0050/$i" | tee -a 2>&1 $i.log #以元素名命名保存log
20 cat $path/i2c-$j/$j-0050/$i | tee -a 2>&1 $i.log
21 sleep 1
22
23 done
24
25
26 done