jrock2004
jrock2004

Reputation: 3501

ZSH alias not working

I am trying to get the following alias setup but I think I am in quote hell

alias apps='dpkg -l | awk "{print $2 "\t" $3}" | fzf'

Thoughts?

Upvotes: 1

Views: 267

Answers (1)

rools
rools

Reputation: 1675

You do not want $2 and $3 variables to be evaluated by the shell but your alias will do:

dpkg -l | awk "{print $2 "\t" $3}" | fzf

Since you awk expression is between doubles quotes, shell will take your variables.

To avoid that you can use:

alias test='dpkg -l | awk "{print \$2 \"\\t\" \$3}" | fzf'

or

alias test="dpkg -l | awk '{print \$2 \"\\t\" \$3}' | fzf"

Upvotes: 1

Related Questions