This question already has an answer here:

When I set in .bashrc something like:

alias="docker stop $(docker ps -aq)"


alias="echo $(ls -l ~)"

obviously never refreshes the command output in $(), so is an string...

So, my question is, there is any way to refresh the command output used as variable ?

marked as duplicate by Christopher, Patrick, G-Man, Jeff Schaller, LinuxSecurityFreak Apr 25 '18 at 5:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • use single quotes – glenn jackman Apr 24 '18 at 19:28
  • @glennjackman Yes, thank you, that’s was I looking for. Put it as answer, if you want, and I’ll mark it as correct. – xpeiro Apr 27 '18 at 14:50