LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2012, 10:02 AM   #1
NothingSpecial
LQ Newbie
 
Registered: Oct 2009
Distribution: Fedora 11
Posts: 4

Rep: Reputation: 0
Recover location of script that is automatically executed after DnD: file -> terminal


Hi guys,

I am facing a problem that I did not cause and at a computer that I do not have direct access to. Basically, I am trying to help a linux newbie (Mrs A) to recover a customized conversion script that works perfectly on a computer of a friend (Mr B) of hers. So imagine at this friends (Mr B) computer they just have to drag and drop a file into the terminal and press return. This executes the appropriate script and writes out the converted file in a standard location. This setting was done by a third friend of Mrs A and Mr B, who I dont know and who apparently knows something about linux (he was also doing the customization of the script. I think he just tried ease the use of this script as much as possible. But in the same way he obscured the location of the script, so that Mr B was not able to give the script to Mrs A).

Next week Mrs A and Mr B will meet and try to recover the location of the script Mr B is using. But I wont be there, so I cannot try to fix it by trial and error.

So my question is now, given an existing link between a file extension (I think thats what it is) and a script in a terminal, how do I/they recover the location of the script?. This is not an hacking exercise. I just want to give Mrs A a recipe that allows both of them with (local/direct) access to the computer to recover the location of the script and copy it.

If it is terminal or distribution specific, then I would say Mr B uses Ubuntu and the standard terminal of it. But if there is a generic solution, I would prefer it, since I am not sure what he is using.

Thank you for your help,

Nothing Special

Last edited by NothingSpecial; 05-19-2012 at 10:07 AM.
 
Old 05-19-2012, 10:31 AM   #2
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,661

Rep: Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540
This could be done by using one of the inotify tools. Does 'ps ax | grep inotify' return anything?
 
Old 05-19-2012, 10:46 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
"drag and drop a file into the terminal" is intriguing. Doing so using urxvt has no effect. Doing so using Xfce's Terminal simply writes the singly quoted name of the file at the command prompt.

What is the effect of doing so with whatever terminal emulator Mr B uses? Does Mr B have to press Enter after doing so or does something happen immediately? Which terminal emulator does Mr B use?
 
Old 05-19-2012, 04:45 PM   #4
NothingSpecial
LQ Newbie
 
Registered: Oct 2009
Distribution: Fedora 11
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,

Thanks for your suggestions and sorry for the delay from my side. I am not able to try anything at Mr Bs computer, because its in another country. But the drag and drop effect I saw on my friends terminal (so Mrs A) was that it copies the file location into the terminal. It looks somehow similar to

Code:
file:///home/user/folder/filename.obj
(.obj is in this case the filename extension -- A wavefront 3D object file, which is basically an ordinary textfile in a certain format)

So if you press enter you basically just send a path of a file and the terminal executes a standard command. Most probably similar as opening any file in the disk browser, which calls the standard program with the path of the file.

Cheers,

Nothing Special

PS I know that Linux usually does not care about file extensions, but the .obj files do not have any #!/bin/bash or similar
 
Old 05-20-2012, 12:06 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Is Mrs A using the same terminal emulator as Mr B?

Dragging from Xfce's file manager, Thunar, into Xfce's terminal emulator, Terminal, the full path of the dragged file is written at the command prompt but there is no file:/ prefix. The full path is single quoted if necessary; any quotes are rendered as \' outside the quotes).

When enter/return is pressed it is the shell that takes whatever is typed at the command prompt, processes it and executes any remaining command (if the shell is bash, the processing is in accordance with shell operation).

What sort of files is Mr B dragging into whichever terminal emulator he is using and which shell is he running?
 
Old 05-20-2012, 01:07 AM   #6
uhelp
Member
 
Registered: Nov 2011
Location: Germany, Bavaria, Nueremberg area
Distribution: openSUSE, Debian, LFS
Posts: 205

Rep: Reputation: 43
I'd search the magic file at this system.

I think this guy wrote a on liner for converting and used a magic file entry to associate the file with that script.

Some of the used locations:
/usr/share/misc/magic #openSUSE
/usr/magic # Debian
/usr/share/magic # Fedora

So first you should find the proper type:
Code:
file OneOfThisFiles.obj
Then list the magic file and grep that entry.

Good luck.

A bit strange sounds the pasted URL.
It seems the guy who set this up modified somewhere somehow the DE...
(but that is an other problem..)

Last edited by uhelp; 05-20-2012 at 01:08 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
Commands work if executed one by one in bash terminal but not from script??? taylorkh Linux - General 6 11-12-2011 08:24 AM
[SOLVED] shell script that will automatically get executed on logging in. hd_pulse Programming 1 05-29-2011 10:06 AM
.wav file executed by script RavhisingRickRude Linux - Newbie 7 12-28-2010 05:16 AM
[SOLVED] Script to run terminal interface program automatically JoeyJoeJoeJr Programming 2 01-18-2010 01:21 PM
Getting location of the script which is currently being executed jiju.jacob Linux - Newbie 4 07-21-2008 06:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:14 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration