My .bashrc alias not run in .desktop file
Solution 1:
While the other answers offer a good workaround for your problem, to answer your question, the right way to use an alias inside a .desktop file is, in your case:
Exec=bash -ic "midos"
That's because aliases from ~/.bashrc
file will work only
in a bash interactive shell (-i
option is used in this case to start bash interactive).
If another user wants to use the same .desktop file, then he must to have defined as well that alias.
Solution 2:
I would be extremely surprised if the GUI has any idea about your shell. You should put the full path in your desktop file:
Exec=/home/erkanmdr/Belgeler/midos/midos.sh
And make sure that your script is executable.
Solution 3:
Little workaround.
Add this #!/bin/bash
to the first line of your script, if it is not there already.
For example your script before:
sometext1
sometext2
sometext3
sometext4
You script after:
#!/bin/bash
sometext1
sometext2
sometext3
sometext4
Now copy your script to /usr/local/bin
, and make it executable:
sudo cp /home/erkanmdr/Belgeler/midos/midos.sh /usr/local/bin/midos
sudo chmod +x /usr/local/bin/midos
After that it should work as you want.