summaryrefslogtreecommitdiff
path: root/example/telnet-cwd
diff options
context:
space:
mode:
Diffstat (limited to 'example/telnet-cwd')
-rwxr-xr-xexample/telnet-cwd19
1 files changed, 19 insertions, 0 deletions
diff --git a/example/telnet-cwd b/example/telnet-cwd
new file mode 100755
index 0000000..bd16048
--- /dev/null
+++ b/example/telnet-cwd
@@ -0,0 +1,19 @@
+#!/bin/sh
+# -*- tcl -*-
+# The next line is executed by /bin/sh, but not tcl \
+exec tclsh "$0" ${1+"$@"}
+
+package require Expect
+
+# telnet-cwd - telnet but with same directory
+#
+# You can extend this idea to save any arbitrary information across telnet
+# Don Libes - Oct 17, 1991.
+
+set prompt "(%|#|\\$) $" ;# default prompt
+catch {set prompt $env(EXPECT_PROMPT)}
+
+eval spawn telnet $argv
+interact -o -nobuffer -re $prompt return
+send "cd [pwd]\r"
+interact