I want to use the name of the current directory in an alias in my .bashrc
file. I'm using basename $PWD
to get the current directory name and adding it using a nested quote in bash. My .bashrc
has this command:
alias test="echo $(basename $PWD)"
The issue is that when I call this command in my terminal it doesn't use my current PWD but always uses the home PWD ~/
. I.e.:
~/$ test
USERNAME
~/$ cd Documents
~/Documents$ test
USERNAME # <<< Should be Documents
Anyone know why the PWD doesn't update?