Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

checking link files



To tell real files from symbolic links, so as to separate the filename from
the  path to be able to change to the actual file the link is pointing to,
i have put down the following script:

 #!/bin/zsh
 zmodload zsh/stat
 inp=$1
 if [ ! -h $1 ];then

        echo $inp " is a real file"
  fi
  if  [ -h $inp   ]; then
        echo $inp " is a symbolic link"
        ffile="`stat +link  $inp`"
        fpath=$ffile:h
        fname=$ffile:t
  fi


Any suggestions to improve it will be welcome

thank you 

Pol




Messages sorted by: Reverse Date, Date, Thread, Author