ip=$(ip addr show eth0 | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*)
if [ -z $ip ]; then
ip=$(ip addr show wlan0 | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*)
fi
if [ -z $ip ]; then
ip=$(ip addr show lo | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*)
fi
export ROS_IP=$ip
export ROS_HOSTNAME=$ip
export ROS_MASTER_URI=http://$ROS_IP:11311
bashrc中配置ip
最新推荐文章于 2024-08-26 16:16:44 发布