Expect Utility (nifty aside)

Replies:

  • None.

Parents:

  • None.

Perhaps folks are already familiar with this, but if not, it's a nifty
little utility.  For example, I use the following script to mount encrypted
volumes on both my workstation and the backup-server (which then are
easily/simply sync'd with unison).

#!/bin/sh

if [ -d $HOME/data/1work ] ; then
  echo encrypted volume already mounted;
else
  expect -c ' \
     puts -nonewline stdout "Bcrypt Password: "
     flush stdout
     stty -echo
     log_user 0
     gets stdin password
     spawn -noecho bctool mount /home/reagle/backup/work-policy
/home/reagle/data; \
     expect "Enter password:"; \
     send "$password\r"; \
     expect; \
     puts $expect_out(buffer); \
     spawn -noecho ssh flux bctool mount /home/reagle/backup/work-policy
/home/reagle/data; \
     expect "Enter password:"; \
     send "$password\r"; '
fi


--

Regards,          http://www.mit.edu/~reagle/
Joseph Reagle     E0 D5 B2 05 B6 12 DA 65  BE 4D E3 C1 6A 66 25 4E

* This email is from an independent academic account and is
 not necessarily representative of my affiliations.

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny