I'm a Gnome user and I'm trying KDE 5. When I was using Nautilus (Gnome), I had a bunch of shell script actions that worked on a list of selected file paths given by the variable $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS.

Reading this answer, I am aware that Dolphin actions provide the code %F: A list of files. Use for apps that can open several local files at once. Each file is passed as a separate argument to the executable program.

The problem is that Each file is passed as a separate argument to the executable program, while my scripts are designed to work with the variable $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS.

Ideally, I would like to reuse my old scripts. Is it possible to convert the Dolphin's %F list and set it as the variable $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS for my scripts?


You can get access to all the arguments passed to a script using $@ in bash, this means technically you can create a wrapper script that first prepares a fake environment variable like this:


Of course you can also simply modify your script to use $@ like this if you want instead of the original nautilus variable:

for var in "$@"
    echo "x" "$var"

Also note in your .desktop file for ServiceMenus you'll want to do something like:

Exec=script %F

Notice that %F doesn't have quotes around it.

  • I'm also struggling to get my Nautilus scripts to work in Dolphin service menus. Can you explain to this learner why this magical "$@" has to be modified (at least sometimes) like this: for filename in "${@}"; do convert "$filename" "${filename%.*}.jpg"; done. – Sadi Jan 25 '20 at 11:15

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.