I'm trying to figure out why
[ -d ~/dir ] ; echo $?
indeed returns 0, if dir exists and is a directory, but
DIR="~/dir" ; [ -d "${DIR}" ] ; echo $?
always returns 1.
echo "${DIR}"
prints ~/dir, as expected. I am given a text file containing path to another file, and thought I'd use cat to store the content inside a variable. What is the proper way to do this?