I am using nautilus file manager and created the file ~/.bash_aliases
with the line
alias naut="nautilus $(pwd) >/dev/null 2>&1 & disown;"
Then I execute
source ~/.bashrc
Then when I type the command naut
, the file manager does not open in the pwd
directory but in the directory in which I last executed source ~/.bashrc
. Which is weird, because when I create an alias
alias naut="pwd; nautilus $(pwd) > /dev/null 2>&1 & disown;"
the command naut
always returns my actual working directory, while opening nautilus in another directory.
How is this possible?
$(pwd)
is expanded at the time thealias
command containing it is run. Try enclosing the alias in single, instead of double, quotes.nautilus .