Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 2. Shell Scripting 2.1. Write a shell script called createFolder.sh that creates a directory under the current directory for each string given as arguments
Part 2. Shell Scripting 2.1. Write a shell script called createFolder.sh that creates a directory under the current directory for each string given as arguments to the script. In your solution, you MUST use the tr command and xargs. Folder name should not contain whitespaces. If the given string contains spaces, change space characters to underscore ( _ ). E.g. If the argument string is 'My Directory, the directory name should be My_Directory Folder name should capitalize all letters. For example when you run your script as /createFolder.sh 'aaa' 'bbb' 'ccc ddd' it should create the directories AAA, BBB and CCC_DDD. 2.2. Write a shell script mystery.sh which takes a directory name as argument and store the line counts (number of lines in the file) of files with a .txt extension under that directory in an array. Your script will then traverse the array and output the (1) line count of each file stored, (ii) only the line counts greater than 10, and (ii) the total number of lines in all files. You should do the appropriate error checking: For example, print an error message if no argument is provided, or if a given argument is not a directory. You will call your script as ./mystery.sh TestDir
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started