LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-01-2005, 09:34 PM   #1
redss
Member
 
Registered: Jun 2003
Posts: 165

Rep: Reputation: 16
How to start associated app in KDE


In my Debian Linux, if you go to a bash prompt and type "picture.jpg", you get an error message. However in KDE, you can hit

Alt-F2 and type "picture.jpg" and KDE will launch the associated application for picture.jpg.

In windows 9x, you can start the associated application from the command prompt with the "start" command ("start

picture.jpg"). (Even easier in windows 2000/XP, where you can just type "picture.jpg")

Is there a linux command where I can kick off the associated app from a bash prompt, like the windows "start" command?
 
Old 03-01-2005, 10:17 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,752
Blog Entries: 4

Rep: Reputation: 76
Uh, not that I know of...

You do realize that you can usually pass the name of a file to the program you want to open it with right?

ie:
$ xmms foobar.mp3
$ gqview foobar.jpg
etc etc...

Not what you are asking for I know, but I think that is as close as you are going to get.
 
Old 03-02-2005, 02:15 AM   #3
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 46
its just a thought , but why dont you make a script so that it could read the extension and launch the desired app

e.g: if the name of the script is ifile then you will type : ifile picture.jpg

i wrote a similar script but to exctract compressed file , mount iso images and install RPM and DEB files , you could look at it and change it to your need

Code:
#!/bin/bash

##############################################
# ifile v0.3
#
# Usage : ifile filename
#
# Created by : Heema
##############################################

FILENAME=$1

echo ""

echo -e "Checking filename extension ................ " "[" "\033[0;32mDone\033[0m" "]" 

EXTENSION=$(file $FILENAME | awk '{ print $2 }')

echo ""

##############################################
# Uncompress files
##############################################

case "$EXTENSION" in

##############################################
# zip
##############################################

Zip)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file" 
	echo ""
	unzip "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;  

# bz2

#if [ "$EXTENSION" == "bz2" ];then
#	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file" 
#	echo ""
#	bunzip2 "$FILENAME"
#	echo ""
#fi

# gz

#if [ "$EXTENSION" == "gz" ];then
#	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
#	echo ""
#	gunzip "$FILENAME"
#	echo ""
#fi

##############################################
# tar
##############################################

POSIX)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
	echo ""
        tar xvf "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;

##############################################
# tar.gz
##############################################

gzip)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
	echo ""
        tar xvzf "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;

##############################################
# tar.bz2
##############################################

bzip2)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
	echo ""
	tar xvjf "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;

##############################################
# rar
##############################################

RAR)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
	echo ""
	unrar x "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;

##############################################
# Install packages
##############################################

##############################################
# Rpm
##############################################

RPM)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
	echo ""
	sudo rpm -Uvh "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;

##############################################
# Deb
##############################################

Debian)
	echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
	echo ""
	sudo dpkg -i "$FILENAME"
	echo ""
	echo -e "\033[0;32mDone\033[0m"
	echo ""
;;

##############################################
# Iso
# Mount and unmount iso file
##############################################

ISO)
       echo -e "This is a" "\033[0;31m$EXTENSION\033[0m" "file"
       echo ""
       if [ ! -d /mnt/iso ];then
               sudo mkdir /mnt/iso
               sudo mount -o loop -t iso9660 "$FILENAME" /mnt/iso
               echo -e "Making mount directory and mounting......  " "[""\033[0;32mDone\033[0m" "]"
	       echo ""
	       echo -e "\033[0;32mDone\033[0m"
	       echo ""
	       exit
       fi

       if [ -d /mnt/iso ];then
               sudo umount -d /mnt/iso
               sudo rmdir /mnt/iso
               echo -e "File unmounted and directory removed...... " "[""\033[0;32mDone\033[0m" "]"
	       echo ""
	       echo -e "\033[0;32mDone\033[0m"
	       echo ""
	       exit
       fi

;;

##############################################
# Add plugins here
##############################################


##############################################
# End
##############################################

# Not supported

*)
	echo -e "\033[0;31mThis format is not supported\033[0m"
	echo ""
;;

esac

Last edited by heema; 03-02-2005 at 02:22 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE crashes on start, so does any KDE app... asdfjkl Linux - Software 3 04-18-2006 03:19 AM
App start location in KDE camorri Linux - Newbie 2 04-20-2004 08:47 AM
Start an X app Iconified podollb Linux - Software 2 10-14-2003 06:13 PM
Adding an app to start menu in GNOME or KDE snatale1 Linux - Newbie 2 08-27-2003 12:12 AM
start an app upon next login bikergirl Linux - General 6 06-06-2003 02:37 PM


All times are GMT -5. The time now is 12:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration