I am trying to create a bash script which uses kpcli in order to automate entries into a kdbx file. While searching over here I found out that you could use expect and send, however this does not seem to be working for me.
set timeout 10
spawn kpcli
match_max 100000000
expect "kpcli:/>"
send "open global.kdbx\n"
expect "Please provide the master password:"
send "mypassword"
expect "kpcli:/>"
send "cd Websites/"
while IFS=" " read -r domainname username password
do
expect "kpcli:/Websites>"
send "new "$domainname""
expect "Username:"
send ""$username""
expect "Password:"
send ""$password""
expect "Retype to verify: "
send "$password"
expect "URL:"
send ""$domainname""
expect "Tags:"
send "\n"
expect "Strings: (a)dd/(e)dit/(d)elete/(c)ancel/(F)inish?"
send "F"
send "\n"
expect "Database was modified. Do you want to save it now? [y/N]: "
send "y"
send "y"
done < sites.txt
Is this the way to do it or is there a better way?