Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!