1

I have created an application shortcut in Ubuntu like this:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=bash -c 'echo $PATH;$SHELL'
Icon=/home/mani/Desktop/omnetpp-5.0/ide/icon.png
Terminal=true
Name=Sample Application
Categories=Development;Application

I saved it with sampleApp.desktop name. Double clicking on the shortcut shows me this:

enter image description here

But, the actual value of $PATH is this:

enter image description here

My guess is that, double clicking on the shortcut, runs the application in a non-interactive shell and the content of my .bashrc will not be parsed. How can I print the full $PATH using desktop shortcut?

0

1 Answer 1

1

You just need to say that you want an (-i) interactive shell and it'll load up the extra files which express your shell preferences. So:

bash -i -c 'echo $PATH; $SHELL -i'

You could also just conditionally echo the path in your .bashrc or .bash_profile and use the environment to trigger that, something like:

if [ "" != "$echopath" ]; then
  echo $PATH
fi

Then your shell could just be:

env echopath=1 bash -i

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .