Assignment1_ShellScript_Assembly Solution

$35.00 $30.80


Automate (some of) your life


Getting familiar with the terminal is a fundamental skill to have. Many of you have various levels of experience using the terminal.


For this assignment, you will be warming up by writing a 1-2 page tutorial on bash scripting. Your tutorial will be embededded in a shell script, explaining how to do something on the terminal that is non-trivial but that can be automated. You will run your script by typing `sh` on the command line as an executable shell script(sh is the GNU Bourne-Again SHell — type ‘man sh’ for more information).  You can look at example ‘sh’ scripts for inspiration on what you can achieve on the web and cite them appropriately.


The tutorial will be done purely in text and and within a file called ‘’. You are required to type your tutorial using a terminal based text editor like ‘vim’, ’emacs’, or ‘nano’ to write your tutorial (I personally use the vim text editor).


Examples of a non-trivial scripts


* Sort a particular column of data from a .csv file (e.g. stock prices).

* Then print out the top ten values, and the average of that column of data.

* Write a shell script that allows you to query information about your computer system from a menu of options.

* Users might like to know information like hard drive space, if a graphics card is available, how fast the cpu is, etc.

* Write a shell script that downloads a webpage (using wget, perhaps to grab some json data), then parses some of the data, and prints it to the terminal.

* You can use your imagination to create other examples!


Part 1 –


<img width=”400px” src=”*MaSfT-bQOxfWnKjFPxMg6g.gif”>


Very Brief Example Tutorial (Template)

(Note this example is fairly trivial, probably worth a C-. You can use it as a template)



Problem Statement: “Often I have to search for different files and directories within my computer system.

In order to do this I use the ‘ls’ command to help orient myself.

Name of command: ls

Example of its usage:

-bash-4.2$ ls



Here is the script that can list the directories and how many total directories are in the current folder.

usage: sh



ls | wc -l



Some ideas for improving the script above script to earn closer to an A are the following:


– Print out a ‘tree’ visualization of the directory you are searching.

– Output the amount of file space each directory is taking up

– Output the directories in color

– Output some graphical patterns after running the command.

– List the history of the last 10 commands that have been run.


* Some inspiration for developing shell scripting skills can be found here:


Resources to help


– A pretty good introduction to shell scripting is here: .




* 33.4% Was your tutorial 1-2 pages (estimate this as 2 regular pieces of printed paper)

* (If you decided you were doing something so cool it had to be longer, was this well justifed)

* If your tutorial is your actual script with comments in it, then it should be able to run. Otherwise, you should also have a script file that can actually be run accompanying your tutorial.

* 33.3% Polish

* Was the tutorial well polished, did something useful, and did not contain any bugs?

* 33.3% Presentation

* Was the writing presented in a clear manner in your own voice (i.e. I should not be able to Google it).

* (Please indicate in your submission at the top if these tutorials can be shared on our piazza board)

* (The very brief tutorial example I gave would probably earn a C- at best 🙂 Go beyond!)


* Note: Your code **must** run on the Khoury machines. That is where you should test it, and this is where we grade it!

* Note: You must also commit any additional files into your repository so we can test your code.

* Points will be lost if you forget!


Feedback Loop


(An optional task that will reinforce your learning throughout the semester)


Read this article and implement the little ‘whatis’ command in your .bashrc.



echo “Did you know that:”; whatis $(ls /bin | shuf -n 1)



This is a nice way to learn a new command everytime you log on!