1 !/bin/bash 2 path="/sys/devices/platform/soc/fd880000.i2c-pld/i2c-0/i2c-4/i2c-15/15-0060" 3 4 f_log=$0 #定义变量f_log,并且将脚本名$0赋值给f_log
5 for ((j=37;j<=66;j++)) #循环ports 37-66
6 do
7 echo "#cat $path/port$i_module_reset" | tee -a 2>&1 ${f_log:3:19}.log #${f_log:3:19}取脚本名,去掉后缀.sh。3:19表示切片
8
9 cat $path/i2c-$j/$j-0050/$i | tee -a 2>&1 ${f_log:3:19}.log
10 sleep 1
11 done