[colug-432] show path stuff

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Fri Oct 30 13:09:01 EDT 2015


On Fri, 30 Oct 2015 12:01:49 -0400, 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?

A minor improvement is to put it in a shell script,
but the while loop is still ugly.
It would also be nice to not need column and sed to clean up the output.

    [srb at colug ~]$ cat bin/lr
    #!/bin/sh
    
    for f in "$@"; do
        while [ "x$f" != "x" ]; do
            ls -ld "$f"
            f=`echo "$f" | sed -e 's%/[^/]*$%%'`
        done
    done | column -t | sed -e 's/\([^ ]\) /\1/g'
    [srb at colug ~]$ 


More information about the colug-432 mailing list