Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
Name[zh_TW]=掛載光碟映像檔
Exec=fuseiso -p %U "/media/$(basename %U)"
Terminal=false
MimeType=application/x-cd-image

, 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

1 Answer 1

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

#!/bin/bash
fuseiso -p $1 "/media/$(basename $1)"

Edit:

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 Nai Jia Aug 24 at 13:20
1  
please see my edit –  hakermania Aug 24 at 13:26
    
Appreciate your explanation. :-) –  Kevin Dong Nai Jia Aug 24 at 13:44

Your Answer

 
discard

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.