Software: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.12 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g. PHP/5.2.4-2ubuntu5.12 uname -a: Linux forum.circlefusion.com 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/share/rkhunter/scripts/ drwxr-xr-x |
Viewing file: readlink.sh (2.62 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | #!/bin/sh # # This is a short script to get the full pathname of a link file. # It has the same effect as the Linux 'readlink -f' command. The # script was written because some systems have no 'readlink' command, # and others have no '-f' option for readlink. As such we use the 'ls' # and 'awk' commands to get the link target. # # We check the 'pwd' command because the shell builtin command will # usually print out the current directory, which may be a link, rather # than the true working directory. The (typically) '/bin/pwd' command # itself shows the true directory. # # A soft (symbolic) link has two parts to it: # # linkname -> target # # Usage: readlink.sh [-f] <linkname> [pwd command] # # # We don't actually do anything with the '-f' option # if it is used. # test "$1" = "-f" && shift LINKNAME=$1 PWD_CMD=$2 test -z "${PWD_CMD}" -o ! -x "${PWD_CMD}" && PWD_CMD="pwd" # # If we were given just a filename, then prepend # the current directory to it. # if [ -z "`echo \"${LINKNAME}\" | grep '/'`" ]; then LINKNAME="`${PWD_CMD}`/${LINKNAME}" fi # # Now do some tests on the link name. # if [ -d "${LINKNAME}" ]; then FNAME="" DIR="${LINKNAME}" else # # We have been given a pathname to a file. Separate # out the filename and the directory. # FNAME=`echo "${LINKNAME}" | sed -e 's:^.*/\([^/]*\)$:\1:'` DIR=`echo "${LINKNAME}" | sed -e 's:/[^/]*$::'` fi # # Get the true directory path. # DIR=`cd ${DIR}; ${PWD_CMD}` # # If we were only given a directory name, then return # its true path. # if [ -z "${FNAME}" ]; then echo "${DIR}" exit fi # # Now we loop round while we have a link. # while test -h "${DIR}/${FNAME}"; do # # Get the link directory, and the target. # LINKNAME="${DIR}" FNAME=`ls -ld ${DIR}/${FNAME} | awk '{ print $NF }'` # # If the target is just a filename, then we # prepend the link directory path. If it isn't # just a filename, then we have a pathname. That # now becomes our new link name. # if [ -z "`echo \"${FNAME}\" | grep '^/'`" ]; then LINKNAME="${LINKNAME}/${FNAME}" else LINKNAME="${FNAME}" fi # # Once again, extract the file name and the directory # path, and then get the real directory path name. # FNAME=`echo "${LINKNAME}" | sed -e 's:^.*/\([^/]*\)$:\1:'` DIR=`echo "${LINKNAME}" | sed -e 's:/[^/]*$::'` DIR=`cd ${DIR}; ${PWD_CMD}` done # # At this point we have a pathname to a file, which is not # a link. To ensure we have the true pathname, we once again # extract the directory. # FNAME=`echo "${LINKNAME}" | sed -e 's:^.*/\([^/]*\)$:\1:'` DIR=`echo "${LINKNAME}" | sed -e 's:/[^/]*$::'` DIR=`cd ${DIR}; ${PWD_CMD}` echo "${DIR}/${FNAME}" exit |
:: Command execute :: | |
--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.05 ]-- |