Write a script or series of scripts which accomplishes the following: Create a function library script which contains any functions and aliases you need for this assignment and make use of them in...

Write a script or series of scripts which accomplishes the following:

Create a function library script which contains any functions and aliases you need for this assignment and make use of them in your main script.


Based on input from the user, enable or disable debugging (you can also make this a command line argument instead of user input).


Use a trap to output some message before the program exits when a user hits Control-C


Use a trap to execute your'cleanup' functionfrom your function library when the program exits


Create a 'cleanup' function which will simply output a nice message that you're cleaning things up (you don't need it to actually do any cleanup since we're not making a mess)


Create a function that takes3 parameters. The first is a function to call, the 2nd is the variable name to set to the output of that function call, the 3rd variable is the parameter(s) to the function. (i'd call mine "setval" and I'd use it like this "setval thisfunc thisvar thisfuncparam")(seethis(Links to an external site.)for help on how to dothis)


Create a function that will output the extension of a file name (i.e. if given "log.txt", it will return "txt") (there are lots of ways to split the string, look into the cut command ortldp's string-manimupation page(Links to an external site.))


Create a function that will output the base name of a file name (i.e. if given "log.txt", it will return "log") -- use a different method of getting the part of the string you want than was used in the get extension function.


Create a(n) alias(es) which execute some of your common commands, including any combination of functions you may find interesting.

Specifically, make one alias called "setthat" which uses setval to set a variable called "that" .. "setthat somefunc"

Make at least one alias that calls another alias.


Create at least 4 aliases total and use each of them somewhere in your scripts.

you could make one that does a long listing (ls -l) and one which calls that on all files to mimic "ls -l -a", or do whatever seems fun for you.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here