Skip to content

Instantly share code, notes, and snippets.

@neonichu
Created February 28, 2012 15:38
Show Gist options
  • Select an option

  • Save neonichu/1933225 to your computer and use it in GitHub Desktop.

Select an option

Save neonichu/1933225 to your computer and use it in GitHub Desktop.
Find the app which ran most recently in the iPhone simulator
#!/bin/sh
## Find the app which ran most recently in the iPhone simulator
SIM_DIR="$HOME/Library/Application Support/iPhone Simulator"
lastapp="`mdfind -onlyin "$SIM_DIR" "kMDItemContentType = \"com.apple.application-bundle\""|head -n 1`"
if [ -z "$1" ]
then
echo "$lastapp"
exit 0
fi
if [ "$1" == "-id" ]
then
dir="`dirname "$lastapp"`"
echo "`basename "$dir"`"
exit 0
fi
echo "usage: $0 [-id]"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment