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

Re: checking link files - recursive search



<posted & mailed>

Matt Wozniski wrote:
> function resolve_recursive {

thank you for your hints
All in all, readlink is better. 

Here included my script to open files (lyx files in my case) in their actual
directory. 

--
Pol


--- enc.

#!/bin/zsh
 
 open="/usr/bin/lyx"
 inp=$1
 if [ ! -h $1 ];then
   if [  -f $1 ];then   # it is a regular file
        $open $inp
   elif [  -d $1 ];then    
        echo $inp " is a directory"
   else 
        echo $inp "not a regular file"
   fi
 elif  [ -h $inp   ]; then  # it is a symbolic link
        file=$(readlink -f "$inp")
        fpath=$file:h
        fname=$file:t
        (cd $fpath && $open $fname)
 fi   



------



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