Created
September 28, 2017 20:16
-
-
Save purplexa/5597f3b1000180df1e11cb57a4da5916 to your computer and use it in GitHub Desktop.
do a reverse tree listing for a file
This file contains hidden or 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 | |
find_parent() { | |
f="$(readlink -f "$1")" | |
parent="$(dirname $f)" | |
if [ "$f" != "$parent" ]; then | |
ls -ld "$parent" | |
find_parent "$parent" | |
fi | |
} | |
find_parent "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment