6
Exec=sh -c "some command' %k

No info in man sh and man exec on %k.
What does %k mean here?

  • 1
    man exec is about system call exec and its family, not about .desktop file. – val Apr 30 '18 at 11:58
6

According to the Desktop Entry Specifications:

%k The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known.

What is not obvious from your example at first sight is that sh -c '...' (if that is POSIX /bin/sh and not symlinked to csh) sets positional arguments starting at $0, which means $0 will be whatever is %k.

  • 1
    No system would be foolish enough to have a sh -> csh symlink. However some old ksh88-based sh implementations have been known to put the first argument after the inline script in $1 instead of $0, which is why you sometimes see things like sh -c 'code "$1"' arg arg or sh -c 'shift "$1"; code ${1+"$@"}' 2 1 args.... Those shouldn't be needed anymore nowadays. Note that $0 is not a positional argument per se. – Stéphane Chazelas Apr 30 '18 at 9:18

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.