<div dir="ltr">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).<div><br></div><div>Jeff</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 30, 2015 at 12:01 PM, <span dir="ltr"><<a href="mailto:jep200404@columbus.rr.com" target="_blank">jep200404@columbus.rr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What's a better way than the following code<br>
of doing ls -ld for a file and all of its parent directories?<br>
<br>
[sb@dojo ~]$ f=/etc/udev/rules.d/70-persistent-ipoib.rules<br>
[sb@dojo ~]$ while [ "x$f" != "x" ]; do ls -ld "$f";f=`echo "$f" | sed -e 's%/[^/]*$%%'`;done<br>
-rw-r--r--. 1 root root 709 Mar 6 2015 /etc/udev/rules.d/70-persistent-ipoib.rules<br>
drwxr-xr-x. 2 root root 38 Jun 23 19:48 /etc/udev/rules.d<br>
drwxr-xr-x. 3 root root 51 Jul 1 13:30 /etc/udev<br>
drwxr-xr-x. 146 root root 12288 Oct 23 15:18 /etc<br>
[sb@dojo ~]$<br>
<br>
_______________________________________________<br>
colug-432 mailing list<br>
<a href="mailto:colug-432@colug.net">colug-432@colug.net</a><br>
<a href="http://lists.colug.net/mailman/listinfo/colug-432" rel="noreferrer" target="_blank">http://lists.colug.net/mailman/listinfo/colug-432</a><br>
</blockquote></div><br></div>