Aqui estão dois oneliners. Uma ls
chamada por componente de caminho:
$ (IFS=/; set -f -- $PWD; for arg; do path="${path%/}/$arg"; ls -dal "$path"; done)
Saída:
# drwxr-xr-x 31 root admin 1122 4 Nov 22:08 /
# drwxr-xr-x 9 root admin 306 3 Nov 17:36 /Users
# drwxr-xr-x+ 67 janmoesen staff 2278 7 Nov 14:46 /Users/janmoesen
# drwxr-xr-x+ 53 janmoesen staff 1802 4 Nov 22:07 /Users/janmoesen/Sites
# drwxr-xr-x 28 janmoesen staff 952 7 Nov 15:01 /Users/janmoesen/Sites/example.com
Com apenas uma chamada para ls
com todos os caminhos:
$ (IFS=/; set -f -- $PWD; for arg; do path="${path%/}/$arg"; paths+=("$path"); done; ls -dal "${paths[@]}")
Saída:
# drwxr-xr-x 31 root admin 1122 4 Nov 22:08 /
# drwxr-xr-x 9 root admin 306 3 Nov 17:36 /Users
# drwxr-xr-x+ 67 janmoesen staff 2278 7 Nov 14:46 /Users/janmoesen
# drwxr-xr-x+ 53 janmoesen staff 1802 4 Nov 22:07 /Users/janmoesen/Sites
# drwxr-xr-x 28 janmoesen staff 952 7 Nov 15:01 /Users/janmoesen/Sites/example.com