OSX shell.execute with password prompt

//make a constant (string) named passShell PW="$(osascript -e 'tell application "System Events" to display dialog "Password:" default answer "" with hidden answer' -e 'text returned of result' 2>/dev/null)" call it: dim mshell as new shell mshell.Execute passShell mshell.Execute "echo ""$PW"" | sudo -S /usr/bin/true" mshell.Execute "echo ""$PW"" | sudo -S //your next shell command mshell.Execute "exit"

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.