[kde-linux] opening linked files

pol linux_milano at yahoo.it
Sun Jul 29 23:15:24 UTC 2007


Anne Wilson wrote:
> I am not a programmer, so this may be utter nonsense, but here are my
> thoughts.  The path for any file is in its properties, so it should be
> possible to get the path and assign it to a variable, which can then be
> used in your script to perform the required act, if examination of the
> mime-type
> passes the test.  Does that sound right?

Thank you for all replies, that helped to devise a script to open files (lyx
files in my case) in their actual directory. 

Here included my script, to be associated to .lyx files

--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   



------




More information about the kde-linux mailing list