#!/usr/bin/expect spawn qr-restore.sh --images "$short_hash_1.jpg,$short_hash_2.jpg" --shamir-secret-sharing --share-threshold 2 expect { -re {\[sudo\] password for pi:} { test_send "$env(password)\r" } } expect { -re {Please type passphrase and press enter} { test_send "$passphrase\r" } } expect { -re {Show secret \(y or n\)\?} { test_send "y\r" } } expect { -re {Secret:\r\n((.|\r\n)+?)\r\nDone} { set restored_secret $expect_out(1,string) } } expect { -re {Done} }