[colug-432] show path stuff

Jeff Frontz jeff.frontz at gmail.com
Fri Oct 30 12:13:05 EDT 2015


That's tricky, right?  The parent of a given directory might not actually
be the same as dirname(1) on the path used to get to the directory (what
with symbolic links and -- at least at one time on certain filesystems --
the potential of a directory entry being present in multiple parent
directories).

Jeff


On Fri, Oct 30, 2015 at 12:01 PM, <jep200404 at columbus.rr.com> wrote:

> What's a better way than the following code
> of doing ls -ld for a file and all of its parent directories?
>
>     [sb at dojo ~]$ f=/etc/udev/rules.d/70-persistent-ipoib.rules
>     [sb at dojo ~]$ while [ "x$f" != "x" ]; do ls -ld "$f";f=`echo "$f" |
> sed -e 's%/[^/]*$%%'`;done
>     -rw-r--r--. 1 root root 709 Mar  6  2015
> /etc/udev/rules.d/70-persistent-ipoib.rules
>     drwxr-xr-x. 2 root root 38 Jun 23 19:48 /etc/udev/rules.d
>     drwxr-xr-x. 3 root root 51 Jul  1 13:30 /etc/udev
>     drwxr-xr-x. 146 root root 12288 Oct 23 15:18 /etc
>     [sb at dojo ~]$
>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20151030/eee836a3/attachment.html 


More information about the colug-432 mailing list