Last active
December 9, 2023 14:04
-
-
Save chockenberry/e33df6b0f4f201bd161763946158c11c to your computer and use it in GitHub Desktop.
A simple shell script to reset CoreSimulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pids=`ps axo pid,command | grep CoreSimulator | grep -v "grep CoreSimulator" | cut -c 1-5` | |
if [ "$1" = "go" ]; then | |
kill -9 $pids | |
elif [ "$1" = "echo" ]; then | |
echo $pids | |
else | |
pid_param=`echo $pids | tr -s ' ' ','` | |
ps -p $pid_param -o pid,command | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rather than the grep/grep -v you can use grep "[C]oreSimulator". The regexp won't match the parameter to grep.