我想知道如何使用Qt 做这样的事情(来源).我查看了文档,但找不到任何方法来检查外部进程是否正在运行.
if [ "$(pidof ksmserver)" ]; then
echo "KDE running."
# KDE-specific stuff here
elif [ "$(pidof gnome-session)" ]; then
echo "GNOME running."
# GNOME-specific stuff here
elif [ "$(pidof xfce-mcs-manage)" ]; then
echo "Xfce running."
# Xfce-specific stuff here
fi
Run Code Online (Sandbox Code Playgroud)