Exec=gnome-terminal -- bash -c 'script="%u";if [[ -e "$script" ]] ; then "$script" ; else exec bash ; fi' line in GNOME desktop file runs scrips, but only w/out spaces in the name. How to run script with any name?
Full description of "what I want" and what I've tried:
I want to open scripts in editor by default from Nemo (file manager AFAIK based on Nautilus) but still be able to open in terminal as another option in Nemo to open these files with.
Web search finds https://askubuntu.com/questions/286621/how-do-i-run-executable-scripts-in-nautilus. Not new for me, but when I set option in file manager to "view", there is no option to run in "open with", I have to open terminal separately and enter script name.
/usr/share/applications/org.gnome.Terminal.desktop, it runs
Exec=gnome-terminal --window. I've found https://askubuntu.com/questions/974756/how-can-i-open-a-extra-console-and-run-a-program-in-it-with-one-command and changed line
Exec=gnome-terminal --window with sample line
Exec=gnome-terminal -- bash -c 'script="%u";if [[ -e "$script" ]] ; then "$script" ; else exec bash ; fi', it works for scripts w/out spaces in names, but with scripts that contain spaces it does not result in expected script output. No big deal maybe, but I want better.
Meaning of e.g.
%u confirmed here: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html.