PDA

View Full Version : scripting question



wlraider70
May 27th, 2009, 07:01 AM
ok im just playing with scripting, and I am having a prolem with getting the password to enter.

....
#!/bin/bash
command sudo anything

sleep 10

pwd yourmom

....


the password wont enter, i tried taking out the sleep.

is the pwd command bad or wrong ?

samjh
May 27th, 2009, 07:37 AM
Eh? Password? You're using the wrong command, I suspect.

pwd is for displaying the current working directory ("print working directory").

_Purple_
May 27th, 2009, 07:50 AM
You can add the script to the sudoers file to run it without using password.

AnRa
May 27th, 2009, 07:50 AM
I think that you are trying to do something like this:

echo "password" | sudo -S command
or

sudo -S command < /path/to/filewithpassword