Score:0

how to use BASH to convert the path to the home folder in the variable bash, in quotation marks into a working one

in flag
K S

Use the script, I am trying to create a directory in my home folder. Due to the specifics of integration with terraforms, parameters are passed in this way:

variable = "value"

It would be great If it worked like this:

variable = value 

Examples:

$ pwd; eee="~/.ccc/ddd"; mkdir -p $eee; tree -a .
/home/user/test
.
└── ~
    └── .ccc
        └── ddd

3 directories, 0 files

or

$ pwd; eee="~/.ccc/ddd"; eee=$(echo $eee); mkdir -p $eee; tree -a .
/home/user/test
.
└── ~
    └── .ccc
        └── ddd

3 directories, 0 files
Score:1
jp flag

Use ${HOME} instead of ~, it is more portable. See this answer for details.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.