This is an old revision of the document!
Corning Community College
CSCS1730 UNIX/Linux Fundamentals
~~TOC~~
To create a script that can, with information provided by the user, display useful reference data.
We've encountered many things in our UNIX journey so far, and have been readily building upon past experiences as we achieve newer and better successes. Of particular focus, we've been looking at shell scripting, and that will be the primary focus of this week's project.
There are collections of information quite useful to anyone journeying in a discipline, and computing is no different. We often encounter information represented in certain units more than others, or various quantities, or even particular number bases.
One particular collection of information involves that of binary, octal, decimal (in signed and unsigned capacities) and hexadecimal numbers. We may encounter a tool that gives us information in octal and we need to feed it into another tool as binary or decimal; these sorts of transactions are common and crop up time and time again.
Having a strong handle on this information is vital for on-going success in the computing field.
As such, it is important to have close at hand the knowledge of the following number bases:
While we don't need to have hundreds of values memorized, it IS a good idea to have a rather quick recollection of enough values that can be used for debugging purposes. The first 16 values of each of these is such a preferred range. Not only does it give us a range of information, but for the powers-of-two bases, can actually fit in and be propagated quite nicely with little added effort.
It is your task to write a script that, when run without any arguments, produces the following table of information (and displayed/formatted in this very manner):
lab46:~/src/unix/irt0$ ./irt0 base 2 | base 8 | base10 | base16 ----------+----------+----------+---------- 0000 | 000 | 0 | 0x00 0001 | 001 | 1 | 0x01 0010 | 002 | 2 | 0x02 0011 | 003 | 3 | 0x03 0100 | 004 | 4 | 0x04 0101 | 005 | 5 | 0x05 0110 | 006 | 6 | 0x06 0111 | 007 | 7 | 0x07 1000 | 010 | 8 | 0x08 1001 | 011 | 9 | 0x09 1010 | 012 | 10 | 0x0A 1011 | 013 | 11 | 0x0B 1100 | 014 | 12 | 0x0C 1101 | 015 | 13 | 0x0D 1110 | 016 | 14 | 0x0E 1111 | 017 | 15 | 0x0F lab46:~/src/unix/irt0$
Additionally, your script should take the following arguments (in this order):
By successfully performing this project, you should have a set of task#.cli files (one for each task). You will want to submit these, along with a upf1steps file.
To submit this project to me using the submit tool, run the following command at your lab46 prompt:
$ submit unix upf1 upf1steps task*.cli Submitting unix project "upf1": -> upf1steps(OK) -> task0.cli(OK) -> task1.cli(OK) -> task2.cli(OK) -> task3.cli(OK) ... SUCCESSFULLY SUBMITTED
You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.
I'll be looking for the following:
78:upf1:final tally of results (78/78) *:upf1:upf1steps submitted via submit tool [2/2] *:upf1:upf1steps covers steps from copy until submit [4/4] *:upf1:upf1steps squelches any STDERR output [4/4] *:upf1:upf1steps only displays required STDOUT output [4/4] *:upf1:task0.cli produces correct result [2/2] *:upf1:task0.cli uses specified input_value [1/1] *:upf1:task0.cli uses specified input_unit [1/1] *:upf1:task0.cli solution in specified output_unit [2/2] *:upf1:task0.cli solution using specified precision [1/1] *:upf1:task0.cli solution using specified delimiter [1/1] *:upf1:task1.cli produces correct result [2/2] *:upf1:task1.cli uses specified input_value [1/1] *:upf1:task1.cli uses specified input_unit [1/1] *:upf1:task1.cli solution in specified output_unit [2/2] *:upf1:task1.cli solution using specified precision [1/1] *:upf1:task1.cli solution using specified delimiter [1/1] *:upf1:task2.cli produces correct result [2/2] *:upf1:task2.cli uses specified input_value [1/1] *:upf1:task2.cli uses specified input_unit [1/1] *:upf1:task2.cli solution in specified output_unit [2/2] *:upf1:task2.cli solution using specified precision [1/1] *:upf1:task2.cli solution using specified delimiter [1/1] *:upf1:task3.cli produces correct result [2/2] *:upf1:task3.cli uses specified input_value [1/1] *:upf1:task3.cli uses specified input_unit [1/1] *:upf1:task3.cli solution in specified output_unit [2/2] *:upf1:task3.cli solution using specified precision [1/1] *:upf1:task3.cli solution using specified delimiter [1/1] *:upf1:task4.cli produces correct result [2/2] *:upf1:task4.cli uses specified input_value [1/1] *:upf1:task4.cli uses specified input_unit [1/1] *:upf1:task4.cli solution in specified output_unit [2/2] *:upf1:task4.cli solution using specified precision [1/1] *:upf1:task4.cli solution using specified delimiter [1/1] *:upf1:task5.cli produces correct result [2/2] *:upf1:task5.cli uses specified input_value [1/1] *:upf1:task5.cli uses specified input_unit [1/1] *:upf1:task5.cli solution in specified output_unit [2/2] *:upf1:task5.cli solution using specified precision [1/1] *:upf1:task5.cli solution using specified delimiter [1/1] *:upf1:task6.cli produces correct result [2/2] *:upf1:task6.cli uses specified input_value [1/1] *:upf1:task6.cli uses specified input_unit [1/1] *:upf1:task6.cli solution in specified output_unit [2/2] *:upf1:task6.cli solution using specified precision [1/1] *:upf1:task6.cli solution using specified delimiter [1/1] *:upf1:task7.cli produces correct result [2/2] *:upf1:task7.cli uses specified input_value [1/1] *:upf1:task7.cli uses specified input_unit [1/1] *:upf1:task7.cli solution in specified output_unit [2/2] *:upf1:task7.cli solution using specified precision [1/1] *:upf1:task7.cli solution using specified delimiter [1/1]