LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-27-2011, 04:33 PM   #1
Virchanza
LQ Newbie
 
Registered: Aug 2009
Posts: 26

Rep: Reputation: Disabled
Make "xdg-open" the default action when X bit isn't set


Let's say you have a PDF file in your home folder. You can use "xdg-open" to use the default application to open it, like this:

Code:
xdg-open ./monkey.pdf
If I try to just execute the PDF in the same fashion as an executable file, then I get this:

Code:
$ ./monkey.pdf
bash: ./monkey.pdf: Permission denied
I wonder...... if....... there's any way to configure the terminal so that it gives special treatment to non-exectuable files?? For instance, I want to be able to just type the following:

Code:
./monkey.pdf
and have it behave as though I wrote:

Code:
xdg-open ./monkey.pdf
Any ideas?
 
Old 11-27-2011, 05:08 PM   #2
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 211

Rep: Reputation: 67
I just do
Code:
open() { command xdg-open "$@" & }
in my .bashrc and leave it at that.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chromium doesn't save "default browser"+ Desktop isn't "snappy" ohadbasan Arch 1 01-25-2010 08:07 PM
Getting this error "Unable to set LC_ALL to default locale" Nabeel Mandriva 3 12-16-2009 04:33 AM
Error for wireless request "Set Bit Rate" (8B20) king_scott_2 Linux - Wireless Networking 3 06-26-2006 05:27 PM
Screensaver of "make" in action ChillingSilence Linux - General 1 01-03-2004 09:00 AM
Permanently set "route add" -host and default gw sacants Linux - Newbie 1 07-18-2003 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:37 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration