在openwrt文件 ar71xx.sh中
查询设备类型时,有这么一句,
machine=$(awk ‘BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}‘ /proc/cpuinfo)
解决:
1)查看cpuinfo
[email protected]:/dev# cat /proc/cpuinfo
system type : Qualcomm Atheros QCA9533 rev 2
machine : Atheros AP143 reference board
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 432.53
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
2)awk截取信息, FS为指定格式; 以 “:” 冒号为分界符,两边都是制表符"\t",第二个参数
/machine指定了以machine为开始的那一行
所以命令的结果是:
Atheros AP143 reference board