openwrt arp 在命令行中可以正常使用,shell中使用arp: not found

遇到的现象

命令行中使用正常,如图
在这里插入图片描述
shell中使用报错(line 3: arp: not found)

#!/bin/sh

arp

输出结果:
在这里插入图片描述

解决

经过一段时间的研究和查询,最终发现在 openwrtarp 确实不是一个命令,而是
cat /proc/net/arp,之所以可以直接使用,是因为/etc/profile 中增加了如下代码:

[ -x /usr/bin/arp -o -x /sbin/arp ] || arp() {
    
     cat /proc/net/arp; }

希望遇到此问题的小伙伴都可以通过本篇文章解决困扰,感谢观阅!!!

猜你喜欢

转载自blog.csdn.net/qq_33191599/article/details/131210074
arp