Is tilde accepted in Bash script for macOS? (Trying to get a user's documents folder path.)

22 Views Asked by At

I'm trying to write a Bash script for macOS to create a directory in a user's documents folder. I do this:

dmg_dir="~/Documents/My dir"

# Create a directory
$(mkdir -p "$dmg_dir")

But it fails as the interpreter seems not to unfold the tilde in the path.

What am I doing wrong?

0

There are 0 best solutions below