Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Assume that you have several files, with different extensions ( e . g . , . cpp , . txt , . dat, etc. )

Assume that you have several files, with different extensions (e.g.,.cpp,.txt,.dat, etc.), present in your current directory on Linux server. The purpose of the script merge_all is to merge all files present in your directory with an extension (provided by the user) into one single file. We need to write and test a bash script that is invoked as:./ merge_all.sh para1 para2Where the shell parameter para1 represents the extension and para2 represents the name of the merged (destination file).Example: $ ./merge_all.sh txt BackupThe above command will append all .txt files in the current directory to the file named Backup.Some important features of your script:1. Your script appends all the files with the desired extension (given as para1) present in the current folder, one by one, to the file para2.2. After appending the files, the merged file specified in par2 should have the read and write permissions only to the owner, and none to the group or others.3. Your script should not make any assumption about the number and types of files present in the current directory. Appropriate messages should be printed in case of non-existence of the needed source files.4. You need to test your script with a variety of files with different extensions in the current directory.5. You will need to do a little research about extracting the extension type of a file in bash and about appending a file to another.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students explore these related Databases questions

Question

What are Fringe Benefits ? List out some.

Answered: 3 weeks ago