Question: I just made the switch to zsh, and copied all my alias from ~/.bash\_profile to ~/.zshrc. Almost all of them worked out-of-the-box, but the one I use to quickly kill nginx didn't. It uses `` to get the pid data out of the pid file for the kill command. It fails with the following:

> 
> cat: /usr/local/var/run/nginx.pid: No such file or directory
> 
> 
> 

So it's trying to run that when the alias is being defined. How could I possibly solve that?

EDIT: The definition of the alias:

```
 alias knx="sudo kill -HUP `cat /usr/local/var/run/nginx.pid`"

```

Thanks!

Marcelo.

Answer: 
Variable and command substitution (i.e. `$foo`, `$(foo)` and ``foo``) are performed inside double quotes. So at the time the alias is defined:

* If `/usr/local/var/run/nginx.pid` does not exist, then you see that error message, and the alias becomes `sudo kill -HUP`.
* If `/usr/local/var/run/nginx.pid` exists and contains (say) 42, then the alias becomes `sudo kill -HUP 42`.

You need to protect the command substitution against evaluation until the alias is evaluated.

```
alias knx='sudo kill -HUP `cat /usr/local/var/run/nginx.pid`'

```

This makes `knx` an alias for `sudo kill -HUP `cat /usr/local/var/run/nginx.pid`` as desired.

Recommended reading: [What is the significance of single and double quotes in environment variables?](https://unix.stackexchange.com/questions/16303/what-is-the-significance-of-single-and-double-quotes-in-environment-variables)
Try single quotes instead of double quotes.