更新时间:2023-12-05 19:16:46
Jefromi 是正确的;这是我认为你想要的逻辑:
Jefromi is correct; here is the logic I think you want:
#!/bin/bash
# this is "test.sh"
if [ $(pidof -x test.sh| wc -w) -gt 2 ]; then
echo "More than 1"
exit
fi
echo "Only one; doing whatever..."