Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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/ %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.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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