#!/usr/bin/env zsh
doit() {
if [[ "$1" = 'stop' ]]; then
for loc in $(cat all-doc); do
if screen -list | grep -q My-$loc; then
pkill -f My-$loc;
fi
done
else
echo "Option: ERROR..."
fi
}
case "$1" in
start)
start;
;;
stop)
doit "$1";
;;
restart)
restart;
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
./ shellscript.sh停止
我出于原因更改了我的问题。 怎么了?我需要杀死从所有文档文件中调用的特定屏幕,例如,我在所有文档中都有“测试”,因此要杀死的屏幕是“我的测试”。