gksudo containing an option for the command

Asked by John Rose

This is not strictly a question about Ubuntu: it's about running CLI. Below is extract from running a command using gksudo where the command conatins an option. gksudo seems to regard the option (--dir) as its own option.

john@JohnDesktop:~$ gksudo desktop-install --dir=/usr/share/applications /home/john/DesktopConfigurationFiles/avidemux.desktop
gksudo: unrecognised option '--dir=/usr/share/applications'

What's the solution?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu sudo Edit question
Assignee:
No assignee Edit question
Solved by:
John Rose
Solved:
Last query:
Last reply:
Revision history for this message
N1ck 7h0m4d4k15 (nicktux) said :
#1

I don't know the command

desktop-install

Instead , I know

desktop-file-install

OR

desktop-file-edit

Try with above commands.

The --dir is rejected by gksudo , because is not an option for gksudo . Read

man gksudo

Thanks

Revision history for this message
John Rose (johnaaronrose) said :
#2

desktop-file-install was my typo. However, the same applies to the corect program:
john@JohnDesktop:~$ gksudo desktop-install --dir=/usr/share/applications /home/john/DesktopConfigurationFiles/avidemux.desktop
gksudo: unrecognised option '--dir=/usr/share/applications'

I realis that --dir is rejected by gksudo because it is not an option for gksudo. The question is how to amend the whole command input so that --dir=/usr/share/applications is an option for desktop-file-install rather than being taken as an option for gksudo.

Revision history for this message
John Rose (johnaaronrose) said :
#3

I just found out the answer. Put ' or "" around after desktop-file-install & at the end:
gksudo 'desktop-file-install --dir=/usr/share/applications /home/john/DesktopConfigurationFiles/avidemux.desktop'