function server() { ipcrm -a # 打开三个请求应答的server ./dgram_mod_req_rep server 11 & ./dgram_mod_req_rep server 12 & ./dgram_mod_req_rep server 13 & # 开启bus ./dgram_mod_bus server 8 & # 开启网络server ./net_mod_socket server 5000 & } function client() { ./net_mod_socket client 5000 } function close() { ps -ef | grep -e "dgram_mod_req_rep" -e "net_mod_socket" -e "dgram_mod_bus" | awk '{print $2}' | xargs -i kill -9 {} ipcrm -a } case ${1} in "server") server ;; "client") client ;; "close") close ;; "") close server client ;; *) echo "error input" exit 1 ;; esac