echo "" > mac.txt
adb disconnect
while read line; do
echo "[ + ] Connecting $line"
adb connect $line
mac=$(adb -s $line shell -n ifconfig eth0 | grep HWaddr | awk '{print $5}')
echo "mac:$mac"
echo $mac >> mac.txt
done < host.txt
上面的代码,如果shell执行不加-n参数,则循环执行一次就会被中断。
shell各参数意义:
shell:
shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]
run remote shell command (interactive shell if no command given
-e: choose escape character, or "none"; default '~'
-n: don't read from stdin
-T: disable pty allocation
-t: allocate a pty if on a tty (-tt: force pty allocation)
-x: disable remote exit codes and stdout/stderr separation
0 条评论