Commit c05834f0 authored by Vitaly Lipatov's avatar Vitaly Lipatov

do value link recursively

parent 1d692ebc
#!/bin/sh #!/bin/sh
# 2003-2006 (c) Etersoft www.etersoft.ru # 2003-2006, 2009 (c) Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
# #
...@@ -18,24 +18,31 @@ if [ "$1" = "-i" ]; then ...@@ -18,24 +18,31 @@ if [ "$1" = "-i" ]; then
shift shift
fi fi
TOFILE=`which $1 2>/dev/null` # use and modify TOFILE recursively
real_file()
if [ -z "$TOFILE" ] ; then {
#echo "$1 is missed in PATH" local LINKTO1 LINKTO
#exit 1 local TOFILE
TOFILE=$1
fi # get canonical path
if [ -e "$1" ] ; then
if [ -L "$TOFILE" ] ; then TOFILE=$1
LINKTO=`readlink "$TOFILE"`
if [ -L "$LINKTO" ] ; then
LINKTO1=`readlink "$LINKTO"`
echo "Note: $TOFILE is link to $LINKTO, that is link to $LINKTO1"
TOFILE="$LINKTO1"
else else
TOFILE=`which $1 2>/dev/null || echo $1`
if [ "$TOFILE" != "$1" ] ; then
echo "Note: $1 is placed as $TOFILE"
fi
fi
# get value of symbolic link
if [ -L "$TOFILE" ] ; then
LINKTO=`readlink "$TOFILE"`
echo "Note: $TOFILE is link to $LINKTO" echo "Note: $TOFILE is link to $LINKTO"
TOFILE="$LINKTO" real_file "$LINKTO"
fi fi
fi FULLFILEPATH=`readlink -f $TOFILE`
}
real_file "$1"
rpm -qf $ARG "$TOFILE" rpm -qf $ARG "$FULLFILEPATH"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment