Monday, March 7, 2011

How to prompt and ask user input in Bash script

User the read command:

#!/bin/bash

echo This script requires running under account with administrator privileges
read -p "Enter name of administrator or root account: " adminUser

su - "$adminUser" -c "/bin/rm -f -r '/Applications/My Application.app'"

No comments:

Post a Comment