I want to mount iso files without root permission by fuseiso, and this is how to mount a iso file:

fuseiso -p '/path/to/isofilename' '/media/isofilename'

, so I make a .desktop file followed Freedesktop Standard (The Exec key) as bellow:

#!/usr/bin/env xdg-open

[Desktop Entry]
Name=Mount ISO image
Exec=fuseiso -p %U "/media/$(basename %U)"

, but it failed.

I think it failed because of $(basename %U), if it is changed to a fixed string, the iso file can be mounted.

How can I solve this problem?


A very easy fix is the following:

Make a custom script of yours and inside the desktop file make it be:

/home/kevin/Documents/Scripts/orWherever/myCustomScript.sh %U (or whatever the path to your custom script is; don't forget to make it executable)

and inside the custom script of yours call

fuseiso -p $1 "/media/$(basename $1)"


Explanation of why it doesn't work the way you tried:

The $(command here) in order to take the output of the basename command, is a bash thing and it doesn't work by default everywhere. The Exec field expects an executable file and (optionally) can pass parameters to it. In fact, %U isn't the only thing that is supported. That's why something that would work in a bash script doesn't always work in such a case.

  • Good answer! but why can't I use baseline for the Exec key in .desktop file? – Kevin Dong Aug 24 '14 at 13:20
  • 1
    please see my edit – hytromo Aug 24 '14 at 13:26
  • Appreciate your explanation. :-) – Kevin Dong Aug 24 '14 at 13:44

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.