What specific changes need to be made in the commands below in order to use a variable username and a variable user_home to create a subdirectory within the current user's home and then to change ownership of the new subdirectory to the current user?
The current commands we are using in a GitHub ubuntu-lastest runner are too brittle because the following commands use the explicit name of the user:
mkdir /home/runner/mysubdirectory/
sudo chown -R runner:runner /home/runner/mysubdirectory/
This OP is asking how to replace /home/runner
with a variable declaration of the current user's home, and how to replace runner:runner
with variable representations of the current user's name.
$USER
refers to the current user.$HOME
is used to get the user's home directory