Wrapping quotes around dotfolders in the home folder breaks all shell commands, e.g.:
[jeff@mypc 0]$
[jeff@mypc 0]$ ls "~/.cache/"
ls: cannot access ~/.cache/: No such file or directory
[jeff@mypc 0]$ ls ~/.cache/
event-sound-cache.tdb.7187a0911f063e087eac3cc10000002b.x86_64-redhat-linux-gnu
mozilla
[jeff@mypc 0]$
Is there some escape sequence that I need to use?
I need to use quotes, because I am accessing subfolders which may contain spaces. I cannot expand the ~
shortcut to /home/jeff
, because I need it to work for any user. I have other constraints that prevent me from using environment variables like $HOME
or $USER
.
Edit 1
Why can't I use $HOME
? Intel fortran has some issues with it apparently:
program mwe
implicit none
character(len = :), allocatable :: f
integer :: unit, io
f = '"$HOME/.cache/test.txt"'
print *, 'f = ', f
open(file = f, newunit = unit, iostat = io)
print *, 'io = ', io ! io = 29, i.e. file not found
end program mwe