Why do 'bash -c <shell script>' and 'exec <shell_script>' work fine on the command line, but not when used for custom app launcher?
by bcsm from LinuxQuestions.org on (#5N4A7)
Hi,
On Linux Mint / Cinnamon, you can edit the menu (that is brought up when clicking logo in bottom left), and add your own application launchers, with an icon and description, which execute using a given command/filepath to executable.
JetBrains IDE only allow you to launch them via terminal, i.e ./pycharm.sh (after you've added the bin/ it's contained in to PATH). To simplify it I set an alias in .bashrc, so that ./pycharm.sh is called whenever I just enter 'pycharm'.
Now, I can make a pycharm application launcher on the start menu by providing it the location of this ./pycharm.sh. However, it broke when I changed the location of the /bin it is in, which is annoying, and will happen again in the future when pycharm updates. (Which will also mess up my $PATH amendments in .bashrc come to think of it, but that's quite easy to change)
So what I want to do is make it so instead of the filepath being located in the command box for the custom launcher, I have './pycharm.sh' or 'pycharm' - which work fine in the terminal. However, it doesn't like that; won't allow it. (I suppose as they only work due to changes in .bashrc, which perhaps the start menu isn't aware of? But surely upon calling bash this becomes known?)
'bash -c pycharm.sh' works on the command line, and is allowed, but doesn't work when used as an application launcher command. Pycharm isn't opened.
'exec pycharm.sh' works on the command line, but isn't allowed as an application launcher command.
Why is it like this? What should I use instead?
Thank you for your time
On Linux Mint / Cinnamon, you can edit the menu (that is brought up when clicking logo in bottom left), and add your own application launchers, with an icon and description, which execute using a given command/filepath to executable.
JetBrains IDE only allow you to launch them via terminal, i.e ./pycharm.sh (after you've added the bin/ it's contained in to PATH). To simplify it I set an alias in .bashrc, so that ./pycharm.sh is called whenever I just enter 'pycharm'.
Now, I can make a pycharm application launcher on the start menu by providing it the location of this ./pycharm.sh. However, it broke when I changed the location of the /bin it is in, which is annoying, and will happen again in the future when pycharm updates. (Which will also mess up my $PATH amendments in .bashrc come to think of it, but that's quite easy to change)
So what I want to do is make it so instead of the filepath being located in the command box for the custom launcher, I have './pycharm.sh' or 'pycharm' - which work fine in the terminal. However, it doesn't like that; won't allow it. (I suppose as they only work due to changes in .bashrc, which perhaps the start menu isn't aware of? But surely upon calling bash this becomes known?)
'bash -c pycharm.sh' works on the command line, and is allowed, but doesn't work when used as an application launcher command. Pycharm isn't opened.
'exec pycharm.sh' works on the command line, but isn't allowed as an application launcher command.
Why is it like this? What should I use instead?
Thank you for your time