Perhaps I have misunderstood Stéphane Chazelas's answer here so I ask another question.
In Bash desire to expand variables inside read without envsubst, arguments or heredocuments (and without any non shell-builtins) because I work in a shared hosting environment in which I don't have many common non shell-builtin utilities.
The variable I want to expand is the environment variable HOME but I make this question variable-agnostic, i.e. I seek a way in which the user can expand inside read:
- An environment variable
- A non environment variable
- Both types of variables
I have tried this which failed:
IFS= read -r domain_dir
${HOME}/example
echo ${domain_dir}
Current output:
${HOME}/exampleDesired output:
MY_HOME_DIRECTORY/example
How to expand variables inside read without envsubst, arguments or heredocuments (and without any non shell-builtins)?
Edit to explain why I find marking this a duplicate is wrong
According to the user terdon which marked this question duplicate, in this question I ask for something which is impossible.
If terdon is correct in that regard than this question is not a duplicate and can be answered separately with an answer that explains if and why it is indeed impossible.