Bash scripting help needed.

Jonyboy

New Member
Hi all I have this script and one of the commands is
Code:
su - jonathan /home/guest/script

This allows the user guest to login to my account on the command line and execute the command "/home/guest/script". The user "guest" has to type in my password.

I was wondering how to use an if/else statement to say whether or not the user succeeded.

I want it to say incorrect password

or

Permission granted

but don't know how to capture the user input whilst they type in the password when "su - jonathan" asks for it.

Thanks
 
If the gust user supplied the wrong password the bash script will not run and they will receive an error from the su command.
 
Back
Top