버그로 인해 동일한 이름의 스크린 세션이 여러 개 있습니다. 다른 화면 세션에 영향을 주지 않고 이 모든 것을 하나의 명령으로 제거하려면 어떻게 해야 합니까?
이 게시물의 명령을 사용했습니다. https://stackoverflow.com/questions/1509677/kill-detached-screen-session
그러나 세션을 인쇄만 하고 제거하지는 않습니다.
다른 세션에 영향을 주지 않고 이러한 세션을 한 번에 제거하려면 어떻게 해야 합니까?
감사합니다
답변1
다음은 my_screens_to_kill_named_the_same이라는 이름의 모든 화면을 종료하는 데 사용한 것입니다.
# Checking if there are some screen named
if screen -list | grep -q "my_screens_to_kill_named_the_same"; then
# Get the list of id of screens named
ids_to_kill="$(screen -ls | awk '/\.my_screens_to_kill_named_the_same\t/' | awk '{print strtonum($1)}')"
# Loop on that list and kill all the screens named
for id_to_kill in ${ids_to_kill}
do
screen -X -S "$id_to_kill" quit
done
fi