有没有一种优雅的方法可以在 BASH 脚本中测试 IP 地址?我可以使用 sed/awk 执行 ifconfig 并缩小 IP 范围,但我认为有一个更简单的解决方案。
我的应用程序基本上在我的内部网中使用 SSH/SCP 脚本,而我不在。所以,我想要这种类型的流程
if IP=192.168.1.1 then do this else then do that
shell bash ifconfig
bash ×1
ifconfig ×1
shell ×1