#!/usr/bin/env bash if [ $# != 1 ]; then echo >&2 "*** ERROR: Need exactly one argument, got $#"; echo >&2 "" exit 0 ; else if [ ! -d "$1" ]; then echo >&2 "The directory $1 does not exist. Stopping now." exit 2; fi decrypt_dir="$1" fi for f in "$decrypt_dir/"*.pcv; do echo -e "Processing $f.." escaped_f=$(printf '%q' "$f") expect <<-EOF set timeout 5 spawn picocrypt "$escaped_f" match_max 100000 expect -exact "Password: " send -- "P?CWqNQ>>AhW>T#Jc^+9=@hbG