I would like my root-requiring bash script to be run from IntelliJ/WebStorm, asking me for the root password when I run it. Having my root password hardcoded in the script is a bad idea of course.
IntelliJ/WebStorm actually has a $Prompt$ macro for reasons like this, which prompts you and uses your input as a value.
So I tried using $Prompt$ along with echo YOURPASSWORD | sudo -S yourcommand
as described in use-sudo-with-password-as-parameter.
Then I pass passwd & script to run to a sudorun.sh
script echo -e $1 | sudo -S $2 $3 $4
(since echo
can't be be the 'program' line) which although works on the CLI, it fails to read echo-stdin on the IntelliJ console.
Ideally, I would like the solution to be configured solely from within IntelliJ and not require specific OS configuration changes outside of IntelliJ.
Perhaps there are other ways to deal with this, so lets improvise!
sudo
(or whatever command it has to be) inside your actual script. If you are unable to even launch your./mybuild.sh
from PhpStorm (because even launching it requires sudo) ... then I cannot really help here. – Iceni