I have the following variable that shows where I should write my report to
REPORT="ZFS(~/Q4Y22/report/q4y22.md)"
I have used sed
to extract the path and dirname
command to get the
~/Q4Y22/report/
dir name which I assign to reportdir
variable.
However when I run the following test, instead of the Q4Y22 dir being created in my home dir, it literally creates the following directory hierachy ~/Q4Y22/report
inside my home for example farai/~/Q4Y22/report
instead of farai/Q4Y22/report
if [ -d $reportdir ]
then
echo "dir exists, keep moving"
else
mkdir -p $reportdir
fi
How do I get around this, I tried using sed to remove the tilde from the path but i was wondering if there is a more clever way