#!/bin/bash # track the ori-file from symbolic link # Usage: # lslk.sh YourFile(s) # @ http://scriptdemo.blogspot.com for nf in $* do if [ -e $nf ]; then echo ${nf} tmpStr="|" cDir=`dirname ${nf}` while [ -h $nf ] do tmpStr="${tmpStr}-" nf=`ls -l ${nf} | awk -F\> '{print $2}' | sed -e 's/\*//g' -e 's/^\ //'` [ `dirname ${nf} | cut -c1` != '/' ] && nf=${cDir}/${nf} [ -h ${nf} ] && echo "${tmpStr}${nf}" cDir=`dirname ${nf}` done echo "${tmpStr}`ls -l ${nf}`" fi echo "" done |
No comments:
Post a Comment