Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to get the imap/smtp password for my email accounts in mutt by parsing an earlier decrypted .gpg file via awk, and assigning the result to a variable used in .muttrc

# Process the password files first
2 # --------------------------------
3 set my_tmpsecret=`gpg -o ~/.secret/.tmp -d ~/.secret/.passwd.gpg`
4 set my_gpass=`awk '/GMail/ {print $2}' ~/.secret/.tmp`
5 set my_del=`rm -f ~/.secret/.tmp`

10 set imap_pass=$my_gpass

During the startup of mutt the .tmp file contains the following string

Gmail    PASSWORD

This is then parsed by awk, and the result assigned to the $my_gpass variable

When trying to start mutt, it still asks me to manually enter the password for imap/smtp. Does anyone have an idea what i'm doing wrong?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Your file has Gmail, but your script is looking for GMail.


Also, the muttrc could be written better:

set my_pass=`gpg -d ~/.secret/passwd.gpg | awk '$1 == "Gmail" {print $2}'`
set imap_pass=$my_pass
set smtp_pass=$my_pass
share|improve this answer
    
Obvious typo. Thanks for your help. –  Michael Aug 27 '12 at 12:10
    
The pipe is also a nice improvement. Thx –  Michael Aug 27 '12 at 12:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.