Skip to content

Instantly share code, notes, and snippets.

@purplexa
Created September 28, 2017 20:16
Show Gist options
  • Save purplexa/5597f3b1000180df1e11cb57a4da5916 to your computer and use it in GitHub Desktop.
Save purplexa/5597f3b1000180df1e11cb57a4da5916 to your computer and use it in GitHub Desktop.
do a reverse tree listing for a file
#!/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