LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-20-2014, 12:41 AM   #1
reggie-man
LQ Newbie
 
Registered: Dec 2014
Location: Australia
Distribution: Xubuntu
Posts: 4

Rep: Reputation: Disabled
How do I write a .desktop file with a reserved character in the Exec key correctly?


I'm trying to make a .desktop file for Minecraft. Nothing appears to happen upon executing the file. I've tried assigning the Exec key as follows:

Code:
java -jar "~/.minecraft/Minecraft.jar"
Code:
java -jar "$HOME/.minecraft/Minecraft.jar"
But I'm not sure how to put in the reserved characters (~ and $) correctly. According to Freedesktop's Desktop Entry Specification:

Quote:
If an argument contains a reserved character the argument must be quoted.
and

Quote:
Quoting must be done by enclosing the argument between double quotes and escaping the double quote character, backtick character ("`"), dollar sign ("$") and backslash character ("\") by preceding it with an additional backslash character. Implementations must undo quoting before expanding field codes and before passing the argument to the executable program.
But that's very confusing to me.

I asked the same question here on the Unix & Linux Stack Exchange.

Last edited by reggie-man; 12-24-2014 at 04:18 PM.
 
Old 12-20-2014, 08:00 PM   #2
reggie-man
LQ Newbie
 
Registered: Dec 2014
Location: Australia
Distribution: Xubuntu
Posts: 4

Original Poster
Rep: Reputation: Disabled
---

Last edited by reggie-man; 12-24-2014 at 04:56 PM. Reason: Removed text because it's a duplicate post
 
Old 12-20-2014, 08:38 PM   #3
reggie-man
LQ Newbie
 
Registered: Dec 2014
Location: Australia
Distribution: Xubuntu
Posts: 4

Original Poster
Rep: Reputation: Disabled
I have received answers here on the Unix & Linux Stack Exchange.

I used this:
Quote:
Originally Posted by janos

It seems a common workaround to execute sh, which will resolve the special symbols and variables correctly:

Code:
Exec=sh -c "java -jar ~/.minecraft/Minecraft.jar"

Last edited by reggie-man; 12-20-2014 at 11:29 PM. Reason: Including solution (or at least workaround) from the Linux & Unix stack exchange
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Read and count each character in text file and then write the result in other text fi Fadly Massere Programming 5 11-17-2013 05:11 PM
[SOLVED] Open/Libre Office Formula Editor - How to write reserved symbols? golmschenk Linux - Newbie 2 03-20-2012 09:39 PM
ubuntu,Netbeans 7.0 ,Glassfish 3.1 Runtime exec C++ program does not write a file. Johannes Marx Programming 6 11-27-2011 09:26 PM
[SOLVED] Read a number x from a file and write a character in the xth column of other file homexylo Programming 7 08-05-2011 05:28 AM
[SOLVED] [bash] find -exec does not execute correctly... RaptorX Programming 3 09-11-2009 05:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration