[colug-432] show path stuff
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Sun Nov 1 12:46:16 EST 2015
Hi Jenny,
On Fri, 30 Oct 2015 11:36:06 -0500, Rick Hornsby <richardjhornsby at gmail.com> wrote:
> Poking around on the interwebs,
> found a command I didn't know existed -
> namei - which seems to do exactly what you want:
>
> $ namei -mo /etc/udev/rules.d/70-persistent-net.rules
> f: /etc/udev/rules.d/70-persistent-net.rules
> drwxr-xr-x root root /
> drwxr-xr-x root root etc
> drwxr-xr-x root root udev
> drwxr-xr-x root root rules.d
> -rw-r--r-- root root 70-persistent-net.rules
If namei exists on AIX, use it.
If namei does not exists on AIX,
then use my clutzy script.
On Fri, 30 Oct 2015 13:09:01 -0400, jep200404 at columbus.rr.com wrote:
> [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 ~]$
A modest improvement on that is to use dirname as follows.
[srb at colug ~]$ cat ~/bin/lr
#!/bin/sh
for f in "$@"; do
# echo "0 f is '${f}"
while true; do
# echo "1 f is '${f}"
ls -ld "$f"
if [ "x$f" == "x/" ]; then
break
fi
f=`dirname "$f"`
done
done | column -t | sed -e 's/\([^ ]\) /\1/g'
[srb at colug ~]$
There might be other stuff that does not work on AIX,
or works differently.
Jim
More information about the colug-432
mailing list