I know the typical way is echo "$PATH", for example. But echo $PATH also works. Also, you don't need the echo command even, you can just type $PATH, and the value of path will be outputted to the screen.
What is the difference in these, and is there any preference for a particular command and why?
var=lsand then ran just$var? – ilkkachu Jul 15 '23 at 17:50declare -p PATH. There is no distinction between printing normal user variables and environment variables. – Paul_Pedant Jul 15 '23 at 22:34