I wrote MyScript.sh! MyScript.sh works great from the command line; it takes one or more file paths as its arguments.
In Ubuntu 18.10 how can I:
- After selecting one or more files in Nautilus/Files.
- Trigger MyScript.sh using the selected file/files as arguments?
I am happy to use either a contextual menu (i.e. right click), or a keyboard shortcut (.e. through Settings > Keyboard > Custom Shortcuts).
Unacceptable answer: I am not looking for someone to tell me to type ./MyScript.sh
in the command in a terminal, and then drag-and-drop a file/files onto it from nautilus followed by <ENTER>
.
Edit 1: I have tried placing MyScript.sh in ~/.local/share/nautilus/scripts/, ensuring it is executable, and right clicking on a file to apply, but no Script submenu appears.
Edit 2: I have set a Keyboard Shortcut in Settings > Keyboard, but the script does not execute.
Run a script with files selected in Nautilus as argument
MyScript.sh
is executable./home/$USER/.local/share/nautilus/scripts/
.Note: The Menu item Scripts > does not appear until there is a script or any file in the folder
/home/$USER/.local/share/nautilus/scripts/
. You can see the location of this folder in the top bar of the Nautilus screenshot above.MyScript.sh
will run with the selected files as arguments.