Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .