Created
October 27, 2010 01:03
-
-
Save tobym/648188 to your computer and use it in GitHub Desktop.
pwdx for mac. Usage: pwx pid
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
function pwdx { | |
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A variant that uses
lsof
's machine-readable format and works properly when the directory name has spaces in it: