Hi all.
I am trying to run a shell script, but since it requires the ‘sudo” command, I am having an issue.
I try to create a string to use, by having the user enter the password in a textbox and having a string
theString = “sudo “ + theUserPassword.text + “ ls”
but it doesn’t seem to see the password.
is my idea… faulty?
Regards
When you execute an application in a shell, you need to specify the entire path to the executable; a shell is not like a terminal where it has a user environment that is all set up with paths to common locations to search.
Your string should look more like “/usr/bin/sudo”, but you’ll need to get the exact path for yourself by running “which sudo” in a normal terminal window.
Maybe:
theString = "echo " + theUserPassword.Text + " | sudo -S ls"
The -S argument to sudo tells it to write the password prompt to StdErr and read the password from StdIn, and the password is echoed through a pipe into StdIn.
Thanks for the options everyone; I will try and advise.
Merry Christmas / Frohe Wehrnacten / Grüße Von krampus 
Regards