I'm trying to learn some scripting. I have a scenario where I have lost my truecrypt password. I run the script below.
#!/bin/sh
DIRECTORY=/media/truecrypt1
for i in 1 2 password
do
clear
echo "Trying $i as a password"
truecrypt -k "" --protect-hidden=no ITSTUDY $DIRECTORY -p $i
if [[ -d "${DIRECTORY}" && ! -L "${DIRECTORY}" ]] ; then
echo "It Worked!"
fi
done
However if the password is wrong I get
Trying 1 as a password
Incorrect password or not a TrueCrypt volume.
Enter password for /mnt/ITSTUDY:
The only way to get the script to start running again I have to ctrl+c. If I push ctrl+c after each failure eventually the script gets to the correct password. However if I have 1000 possible passwords that is not an option.
How do I get the script to look for the output
Incorrect password or not a TrueCrypt volume.
then send a ctrl+c? or quit? Everything I've tried so far doesn't proceed below the truecrypt -k line until I do the ctrl+c.