ip=$(ifconfig |grep broadcast|awk 'NR<2 {print $2}') echo $ip ifconfig注:在配置crontab定时任务时,ifconfig为生效,可在脚本上加入
. /etc/profile 使环境变量生效