what is the output in namechnage file and what inouts did u use? do this as if you are usingn a linux system

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

what is the output in namechnage file and what inouts did u use? do this as if you are usingn a linux system

1. Create a script in your Labe5 folder named namechange that meets the following specifications. The script will run as: namechange -f find
-r replace string-to-modify
2. Use getopts to utilize both arguments and functions.
= what to replace in the filename string. Should have an argument after, save to a variable
-r
-f =
what to find in the filename string. Should have an argument after, save to a variable
-h
printHelp, a function that has a help guide
3. Create a function called printHelp. printHelp should output the following:
Usage: namechange -f find -r replace "string to modify"
-f The text to find in the filename
-r The replacement text for the new filename
4. If -r or -f have empty (no) arguments after them, output "User must provide string for find and string for replace" following by the
usage guide in the printHelp function
o getopts has built in ways to handle this checking
5. For the string given, string-to-modify , find the pattern to be replaced and replace it with the pattern requested using sed - you may just
want to have sed use the -E option ;)
# Sample runs of working script
$ bash namechange -h
Usage: namechange -f find -r replace "string to modify"
-f The text to find in the filename
-r The replacement text for the new filename
$ bash namechange -f "\s" -r "-" "hello world"
hello-world
$ bash namechange -f "er+" -r "error" "spellingerrrr".
spellingerror
Transcribed Image Text:1. Create a script in your Labe5 folder named namechange that meets the following specifications. The script will run as: namechange -f find -r replace string-to-modify 2. Use getopts to utilize both arguments and functions. = what to replace in the filename string. Should have an argument after, save to a variable -r -f = what to find in the filename string. Should have an argument after, save to a variable -h printHelp, a function that has a help guide 3. Create a function called printHelp. printHelp should output the following: Usage: namechange -f find -r replace "string to modify" -f The text to find in the filename -r The replacement text for the new filename 4. If -r or -f have empty (no) arguments after them, output "User must provide string for find and string for replace" following by the usage guide in the printHelp function o getopts has built in ways to handle this checking 5. For the string given, string-to-modify , find the pattern to be replaced and replace it with the pattern requested using sed - you may just want to have sed use the -E option ;) # Sample runs of working script $ bash namechange -h Usage: namechange -f find -r replace "string to modify" -f The text to find in the filename -r The replacement text for the new filename $ bash namechange -f "\s" -r "-" "hello world" hello-world $ bash namechange -f "er+" -r "error" "spellingerrrr". spellingerror
Expert Solution
Inputs

The function will take files as inputs in which we have to replace the sentences or characters or letters with new letters.

or

The function will take string as input to replace the characters

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education