Aqui está minha tentativa de fornecer essa funcionalidade. Eu optei por usar stat
, while
loop e dirname
.
Eu criei este script, walkdir.bash
:
#/bin/bash
cwd="$1"
while [ "x$cwd" != x/ ]; do
info='stat "$cwd" |grep "Access: ("'
printf "%s : %s\n" "$info" "$cwd"
cwd='dirname "$cwd"';
done
Você o executa assim:
$ walkdir.bash "/home/saml/blog/vmware_networking_tutorial/url.txt"
Access: (0664/-rw-rw-r--) Uid: ( 500/ saml) Gid: ( 501/ saml) : /home/saml/blog/vmware_networking_tutorial/url.txt
Access: (0775/drwxrwxr-x) Uid: ( 500/ saml) Gid: ( 501/ saml) : /home/saml/blog/vmware_networking_tutorial
Access: (0775/drwxrwxr-x) Uid: ( 500/ saml) Gid: ( 501/ saml) : /home/saml/blog
Access: (0700/drwx------) Uid: ( 500/ saml) Gid: ( 501/ saml) : /home/saml
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) : /home