This is on OSX El Capitan, but also happens in my Ubuntu aliases as well.
I ran into an issue with an alias I created to pass the working directory to a docker container.
this wont work (always passes ~/Users/username for $(pwd) no matter what directory I'm in):
alias phpqa="docker run --rm -u $UID -v $(pwd):/app eko3alpha/docker-phpqa"
works:
alias phpqa='docker run --rm -u $UID -v $(pwd):/app eko3alpha/docker-phpqa'
However I started getting unexpected errors in my script when the wrong path was being passed in. So I did an experiment. I added both these aliases into my ~/.bash_profile.
alias getpath="echo $(pwd)"
alias getpath2='echo $(pwd)'
I logged off and then logged back in.
Change directory:
$ cd /Users/username/correct/path/to/project
Execute both aliases:
$ getpath
/Users/username
$ getpath2
/Users/username/correct/path/to/project
the alias with the double quotes always returns the users home directory while the alias with single quotes returns the current directory. Can someone explain why that is?