#!/bin/bash ######################################################################### # Author: Zhang Shuai # # Date: 2019-05-23 # # Description: launch a MPI Gazebo simulation task # # Usage: ./MPI_Gazebo_launch.sh [hostfile] [world's path and name] # ######################################################################### host_file=$1 world_file=$2 host_count=0 hosts=() #获取hostfile文件中的host名字 while read line do if [ -n "$line" ] then temp=${line% *} hosts[$host_count]=$temp let host_count=$host_count+1 fi done < $host_file echo "host_count:$host_count" for((i=0;i /dev/null 2>&1 "cd ~/MPI; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; exit" echo "${hosts[$i]}:close_good" done echo simulation_done! exit 0