执行ifconfig eth0
eth0: ip 192.168.1.104 mask 255.255.255.0 flags [up broadcast running multicast]
执行
busybox ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
inet addr:192.168.1.104 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::211:22ff:fe33:4455/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:537505 errors:0 dropped:918 overruns:0 frame:0
TX packets:2479 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:45678848 (43.5 MiB) TX bytes:699618 (683.2 KiB)
Interrupt:83
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:64 errors:0 dropped:0 overruns:0 frame:0
TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4704 (4.5 KiB) TX bytes:4704 (4.5 KiB)
难道系统中存在两个这个命令吗?
果然
find -name ifconfig
./system/busybox/sbin/ifconfig
./system/bin/ifconfig
看来默认执行的是system/bin下面的命令。
打印path
PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/system/busybox/bin:/system/busybox/sbin
echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/system/busybox/bin:/system/busybox/sbin
/system/bin/ifconfig 是放在PATH路径前面的,就先执行这个了。要想默认执行busybox里面的,要把路径/system/busybox/sbin放在/system/bin目录前面。