Sample Header Ad - 728x90

replacing explicit user names with variables in mkdir and chown

0 votes
1 answer
197 views
**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.
Asked by CodeMed (5357 rep)
Nov 19, 2022, 12:03 AM
Last activity: Nov 19, 2022, 09:28 AM