请用Shell编程来实现:当输入不同的选择时,执行不同的操作,如:输入start 开始启动应用程序myfiles,输入stop时,关闭myfiles,输入status时,查看myfiles进程,
否则执行exit显示“EXIT!”并退出程序。
#!/bin/sh while [ $ifexit != 1 ] do read -p "Please input a choice:" choice case $choice in "start") echo "myfiles will startup." myfiles & ;; "stop") echo "myfile will be killed" killall -9 myfiles ;; "status") ps -ef | grep "myfiles" ;; *) echo "EXIT!" ifexit=1 ;; esac done exit 0
本文介绍如何使用Shell编程实现对应用程序myfiles的启动、关闭和状态检查,通过命令交互完成进程管理。
3543

被折叠的 条评论
为什么被折叠?



