ip=$(ifconfig |grep broadcast|awk 'NR<2 {print $2}')
echo $ip
ifconfig

注:在配置crontab定时任务时,ifconfig为生效,可在脚本上加入
. /etc/profile 
使环境变量生效

 

 posted on 2021-02-22 22:00  boye169  阅读(67)  评论(0编辑  收藏  举报