Bash, aliases, and command line arguements

I was recently doing some work with gzip’d files. It got kind of repetitive to keep typing

gunzip file
head file
gzip file

I know there is a zcat but I don’t want to have to type

zcat file | head


You can create aliases in your .bashrc file. These are quick shortcut commands.
The following does not work

alias zhead='zcat $1 | head' #does NOT work

In order for this to work you have to create a function in your .bashrc and call it from the alias.

function zh(){
    zcat $1 | head
alias zhead='zh'