how2 shell cmd into variable

How do I place the result of a shell command into a variable. I would like to save the pwd in $DIR. I tried...

pwd | $DIR
$DIR < pwd
DIR=pwd

thanks! jz

DIR=$( pwd )

However, you don't need to do that as the current directory is stored in $PWD:

DIR=$PWD

Thanks, I knew I had something small biting me in the rump :slight_smile: