1. Create x empty files in a given directory (x is a number), following a naming
ID: 669100 • Letter: 1
Question
1. Create x empty files in a given directory (x is a number), following a naming format like this: myfile1, myfile2, etc. Ask the user to enter the first part file name and the number of files he/she wants to create. Hint: you may use the “touch” command to quickly create empty files.
2. Write a script to create the following directory structure in a directory of user’s choice. The user can supply the directory of choice as an argument; if missing, prompt the user to enter one from the command line.
Image (user selected existing directory) ----- Data< CacheExplanation / Answer
1) touch $1{1..10}
2) if [ "$#" -eq 0 ]; then
echo "Enter 1 argument"
else
mkdir $1/Data
mkdir $1/Data/Image
mkdir $1/Data/Cache
fi
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.