10

I was trying to make some scripts dynamic by including the environment variable $LOGNAME and even $HOME. but it don't seem to work when placed in a launcher.

I am trying to make code a bit more dynamic

/home/simon/Desktop/firefox_test.bash

I tried

$HOME/Desktop/firefox_test.bash 

and

/home/$LOGNAME/Desktop/firefox_test.html

but it don't seem to read the environment variables.

chip
  • 2,971

1 Answers1

16

Starter commands usually aren't evaluated by a shell so environment variable don't get evaluated.

Use

 sh -c '$HOME/Desktop/firefox_test.bash'

or

 sh -c 'xdg-open /home/$LOGNAME/Desktop/firefox_test.html'

In the .desktop launcher file, you will then have this, for example, for the Exec line:

Exec=sh -c '$HOME/Desktop/firefox_test.bash'
Gabriel Staples
  • 11,502
  • 14
  • 97
  • 142