opening linked files

pol linux_milano at yahoo.it
Mon Jul 30 08:05:00 BST 2007


Scott Bicknell wrote:
> Write a shell script that changes to the directory you want, then
> runs the program and loads a file from its command-line
> arguments.


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   



------

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list