I'm running Bash 5.1.4 on Debian.
I'm writing a post-installation script to copy configuration and other files to locations in my home directory. I add the intended destination to each file at the beginning with a prefix; for example: # DEST: $HOME/.config/mousepad/Thunar
(of course, in the script the file name will be substituted by a variable, and the hash symbol by the appropiate comment character; this line appears within the first 10 lines, not necessarily at the first, so I don't mess with shebangs).
To get these locations I'm using this command: head Thunar.acs | egrep "DEST:" | awk '{print $3}
, which returns literally $HOME/.config/Thunar
; I'd like it to expand $HOME
. What I mean is when I try ls $(head Thunar.acs | egrep "DEST:" | awk '{print $2})
I get the error ls: cannot access '$HOME/.config/Thunar/': No such file or directory
. I read this question and tried all of the combination of double quotes in the selected answer, but I still got the error. How can I solve this?
Enclosing the variable name in braces doesn't work either.
Thanks!