I am creating a basic bash script to create a blank file each day that I can use for taking notes. I'm naming the file with the current date and then trying to write it into a notes directory under my Documents folder. Everything works fine if I use the complete path but I'd rather use ~ instead of typing out my home dir.
This works:
notesPath="/Users/erik/Documents/RN/_DailyNotes/"
And this fails with a "no such file or directory" error:
notesPath="~/Documents/RN/_DailyNotes/"
I'm doing the following after creating notesPath:
todayFile=$notesPath$fileName
todayPretty=$(date "+%m/%d/%y")
echo "Daily $todayPretty" >> $todayFile
Any ideas?
~is not resolving to your home folder.