Re: opening linked files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux