summaryrefslogtreecommitdiff
path: root/example/autopasswd
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-04 17:21:04 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-04 17:21:04 -0800
commite0b431a48cc3ac5d3ec32f06eddd9708ad655fa2 (patch)
treece4c73521220fbb751c2be6a42e85ff6a6cbff97 /example/autopasswd
downloadexpect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.tar.gz
expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.tar.bz2
expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.zip
Imported Upstream version 5.45upstream/5.45
Diffstat (limited to 'example/autopasswd')
-rwxr-xr-xexample/autopasswd17
1 files changed, 17 insertions, 0 deletions
diff --git a/example/autopasswd b/example/autopasswd
new file mode 100755
index 0000000..1d095e2
--- /dev/null
+++ b/example/autopasswd
@@ -0,0 +1,17 @@
+#!/bin/sh
+# -*- tcl -*-
+# The next line is executed by /bin/sh, but not tcl \
+exec tclsh "$0" ${1+"$@"}
+
+package require Expect
+
+# wrapper to make passwd(1) be non-interactive
+# username is passed as 1st arg, passwd as 2nd
+
+set password [lindex $argv 1]
+spawn passwd [lindex $argv 0]
+expect "assword:"
+send -- "$password\r"
+expect "assword:"
+send -- "$password\r"
+expect eof