I have created 3 folders named Paul, James & Kurt.
In each folder that I've created I must also have 3 folders named (Documents, Pictures, Music).
And also
Each named folder should have a README file containing the following contents: "These folders are used to store employee details."
Can some kindly guide me through this
The below will create new directories for all lines in users.txt
and a sub-directory in each for Documents
with a README
in it with the above contents. Hope it helps.
Sub=Documents
for names in $(cat "users.txt"); do
mkdir -p "$names"/{"$Sub",} && touch "$names"/"$Sub"/README.txt &&
echo "These folders are used to store employee details." > "$names"/"$Sub"/README.txt
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.