Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I set up an alias:

alias gpgagentexport="eval $(cat ~/.gpg-agent-info) ; export GPG_AGENT_INFO"

However when I source my .bashrc the $(cat ...) is evaluated at that point. But I want to evaluate it when I run the alias gpgagentexport (after the contents of ~/.gpg-agent-info has changed).

So is there some sort of escaping, quoting or syntax to achieve that?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Use single quotes:

alias gpgagentexport='eval $(cat ~/.gpg-agent-info) ; export GPG_AGENT_INFO'
share|improve this answer
    
Ah, thank you. I should go and read a bit more about bash quoting rules. –  Hamish Downer Apr 13 '13 at 16:40
add comment

Escaping the $ should also work:

 alias gpgagentexport="eval \$(cat ~/.gpg-agent-info) ; export GPG_AGENT_INFO"
share|improve this answer
add comment

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.