#!/bin/bash pid=$(ps aux | grep roscore | grep -v grep | awk '{print $2}' | sort -n | head -n 1) # 获取进程号 echo "roscore command is running, pid:${pid}" kill ${pid} && echo "roscore command is complete" pid=$(ps aux | grep roslaunch | grep -v grep | awk '{print $2}' | sort -n | head -n 1) # 获取进程号 echo "roslaunch command is running, pid:${pid}" kill ${pid} && echo "roslaunch command is complete" pid=$(ps aux | grep mpiexec | grep -v grep | awk '{print $2}' | sort -n | head -n 1) # 获取进程号 echo "mpiexec command is running, pid:${pid}" kill ${pid} && echo "mpiexec command is complete" pid=$(ps aux | grep gzserver | grep -v grep | awk '{print $2}' | sort -n | head -n 1) # 获取进程号 echo "gzserver command is running, pid:${pid}" kill ${pid} && echo "gzserver command is complete" exit 0