#!/usr/bin/expect
# Run su with given password
# call this sux <passwd> <commands>
# works for X apps only
# Written by Eko M. Budi,

set password [lindex $argv 0]
spawn su -c [lindex $argv 1] [lindex $argv 2] [lindex $argv 3]
expect "Password:"
send "$password\r"
wait
