0

I working in a custom bash command for open all files(*.*), the command who i make in bash is named "open".

This is the content of my bash command file named "open":

#!/bin/bash
xmessage -center "File $1, has been executed."
exit

Here a screenshot of nautilus file manager: enter image description here

Here a screenshot of nemo file manager: enter image description here

So, i want to replace the original command who uses all file manager or nemo and nautilus only, with my custom bash command:

For example if the original command of nautilus or nemo is:

xdg-open "$1"

And in this circumstance:

xdg-open "cat.jpg"

I will replace it with my custom bash command named "open", like this:

open "$1"

The replacement example:

mv "xdg-open" "xdg-open.old"
mv "open" "xdg-open"

So, when the user do double click in any file or click on open button in nemo or nautilus or other file manager, all files or the selected file will be open with my custom bash command don't caring the extension or mime type.

So, Do you know which command nemo or nautilus use for open any file? or Do you know about other commands like xdg-open or mimeopen who maybe are used by nautilus or nemo?

note: i not want add a custom command, i want replace the original command.

0

It isn't possible to open a group of selected files by double-clicking. That's because you can only click on one file at a time. Your first click of a double-click on one of the files in the group will cause that one file to be selected and the others to be deselected. So, only that one clicked file will be opened when the second click of the double-click occurs.

Otherwise, you can do what you want by changing the application associated with a particular type of file as follows:

  1. Right-click on a file of a particular type (e.g. jpg),
  2. Click Open With in the popup menu,
  3. Click Other Application in the popup submenu; an "Open With" dialog box should appear
  4. Click Use a custom command in the "Open With" dialog box; a textbox should appear,
  5. Type your script file name (including path if needed) in the textbox,
  6. Make sure the "Remember this application for..." checkbox is checked, and
  7. Click the Open button.

The selected file should then open using your script. After that, any selected group of files opened by hitting the Enter key or selecting "Open" from the right-click menu should be opened using your script. Any single file double-clicked or opened otherwise should also open using your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.