Are you a spammer

Please note, that the first 3 posts you make, will need to be approved by a forum Administrator or Moderator before they are publicly viewable.
Each application to join this forum is checked at the Stop Forum Spam website. If the email or IP address appears there when checked, you will not be allowed to join this forum.
If you get past this check and post spam on this forum, your posts will be immediately deleted and your account inactivated.You will then be banned and your IP will be submitted to your ISP, notifying them of your spamming. So your spam links will only be seen for an hour or two at most. In other words, don't waste your time and ours.

This forum is for the use and enjoyment of the members and visitors looking to learn about and share information regarding the topics listed. It is not a free-for-all advertising venue. Your time would be better spent pursuing legitimate avenues of promoting your websites.

command line run with default app

Source code I have written openly published for your viewing pleasure.


command line run with default app

Postby linuxux » Thu Oct 08, 2009 7:36 pm

I'm looking for a single command that would tell the environment to launch a file in it's configured way.
it could be "readme.txt" or "movie.avi"
I think in windows if you type "start readme.txt" it will open with notepad, "start movie.avi" might start in VLC, if the associations are configured.

I found open in the bash manual: Open a file in its default application

$ open test.txt
Couldnt get a file descriptor referring to the console
$ bash open test.txt
/bin/open: /bin/open: cannot execute binary file

I'm guessing this uses a bash-known apps or is something completely different.

I'd like the script to not have to figure out anything, just use the known app.

update:

OK well a few more minutes with google found close to what I need...

http://linuxcommando.blogspot.com/2009/ ... g-its.html
$ gnome-open cisco.doc
For KDE users, use kde-open instead.
$ xdg-open cisco.doc

What is the simplest thing that can be done to determine if it is KDE or Gnome?
linuxux
U.E. Knowledgable
U.E. Knowledgable
 
Posts: 47
Joined: Mon Sep 07, 2009 7:47 pm
Operating System: Ultimate Edition 3.1 64 BIT



Re: command line run with default app

Postby linuxux » Thu Oct 08, 2009 7:55 pm

xdg-open works fine on both KDE and Gnome boxes.

Thanks google :)
linuxux
U.E. Knowledgable
U.E. Knowledgable
 
Posts: 47
Joined: Mon Sep 07, 2009 7:47 pm
Operating System: Ultimate Edition 3.1 64 BIT



Re: command line run with default app

Postby ubuntu@@xx » Thu Oct 15, 2009 8:55 am

You can use the command " Which " ,{for running programs only not ordinary files} for example if you want to call the Firefox browser , you can write in your command line:
> which firefox
then it will reply with something like :
> usr/bin/firefox

then you just repeat writing that path and the program will be executed 8-)
ubuntu@@xx
U.E. Newbie
U.E. Newbie
 
Posts: 2
Joined: Tue Oct 06, 2009 9:55 am
Operating System: Ultimate Edition 3.0 32 BIT


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests