Skip to content

Instantly share code, notes, and snippets.

@HokieGeek
Last active March 17, 2016 13:17
Show Gist options
  • Save HokieGeek/05413c6ce48d4a968cfe to your computer and use it in GitHub Desktop.
Save HokieGeek/05413c6ce48d4a968cfe to your computer and use it in GitHub Desktop.
ps -p $$ | awk 'END{ print $NF }' | egrep -q 't?csh' \
&& lsof +p $$ | awk '$9 ~ /gethere.sh/ { system("dirname "$9) }' \
|| test -z "$BASH_SOURCE" \
&& echo "`dirname ${0}`" \
|| echo "`dirname ${BASH_SOURCE}`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment