bash assignment


Bash Assignment

The bash assignment consists of 3 parts. Each part will contribute to the total assignment mark. The rubric and submission for this assignment is on blackboard.

To get full marks for any script, your scripts must have the following elements as covered in class:

script interpreter line

command line processor using while, shift, and case if the script allows command line options or arguments

comments describing the script

error messages going to stderr

correct exit status

Add command line arguments to a script

The following script fragment will roll virtual dice and show what was rolled and what the total rolled was.


while [ $count -gt 0 ]; do

roll=$(( $RANDOM % $sides +1 ))

sum=$(( $sum + $roll ))

echo "Rolled $roll"

count=$((count - 1))


echo "You rolled a total of $sum"

This script expects two variables to be defined before it runs.

count should contains the number of dice to roll

sides should contain the number of sides each die should have

Modify the script to allow the user to run the script without any command line arguments which will cause it to roll a pair of 6-sided dice.

Accept the following command line options:

-h or --help should display command line syntax and exit successfully

-c N or --count N should set the count of dice to roll to N, N must be a number from 1 to 9

-s N or --sides N should set the number of sides per die to N, N must be a number from 4 to 20

Display an error message and exit with a failed status if the user puts bad input on the command line.

Memory Usage Report

Create a simple but human friendly report on memory usage. You can use the free command to get the data for your report.

Display a report title

Display the total amount of RAM installed and the amount of free RAM

Calculate and display the sum of the used and cached RAM

Calculate and display the difference between the available and free amounts

Calculate and display how much RAM is shared as a percentage of the RAM used

Calculate and display how much RAM is used as a percentage of the total RAM

Calculate and display how much RAM is used for cache as a percentage of the total RAM

Your report should have a title. Each output data item should be appropriately labelled and scaled to display in megabytes. No command line options or arguments are required for this script.

Command Source Identification

Create a simple script that asks a user for command names, then tells them which software package the command comes from if it comes from a package that is installed on the system. You can use the dpkg -S filepath command to identify the software package.

If the user gives no command names as arguments on the command line, ask them for a command name, identify the source according to the rules below, and then ask for the next command name in a loop

If the user gives you one or more command names as arguments on the command line, identify sources for them instead of asking for file names

Accept a command line help option to display command help

Rules for identifying the source of a command name:

If the user just hits enter when asked for a command name, exit successfully

If the user gives a non-existent command name, give them an error message and move on to the next command name

If they give you a command name that didn’t come from a software package, tell them that it didn’t and tell them the full pathname of the file containing the command and who owns that file

If they give you a command name that doesn’t come from a file, tell them and move on to the next command name

Evner: Linux, Scripting

Se mere: bash function, bash assign output to variable, bash if, bash assign variable from command, what is bash set -e, bash variable substitution, bash echo variable in string, bash script, xsd schema cache memory, sqlite shared memory database, visual studio 2005 shared memory wrapper, java assignment memory, operating systems assignment memory java, sqlite shared memory, memory assignment java applications, delete cache memory mobile j2me, shared memory life cycle, sqllite shared memory, aspnet memory problem shared, terracotta cache memory instead queues

Om arbejdsgiveren:
( 0 bedømmelser ) Toronto, Canada

Projekt ID: #18102274

10 freelancere byder i gennemsnit $184 på dette job


Hello from Greece, Do you have ssh aceess to the server? Would you like to have a chat? Regards, Dimitsi

$555 CAD in 3 dage
(344 bedømmelser)

Hello How are you? I'm a System Engineer with coding skills. I had done many projects using Bash scripting. I can help. Regards.

$250 CAD in 3 dage
(27 bedømmelser)

Hi, Looks like this is an assignment work. I can write a bash script for your requirement. But would like to know when you need. I cannot write in 5 or 10 hours as i already have some project ongoing. If you give me Flere

$66 CAD in 3 dage
(20 bedømmelser)

Hello, I have done this script earlier and can provide the answer now. You can check the script and pay. I have also done the scripts "Add command line arguments to a script" and "Command Source Identification" Flere

$200 CAD in 0 dage
(11 bedømmelser)

hello,how are you. i read your bid carefully. i am c/c++, linux expert and have full experience for 10 years. c/c++, linux is my top skill and i can complete your project by using c/c++, linux. i can provide most qu Flere

$155 CAD in 3 dage
(1 bedømmelse)
$30 CAD på 1 dag
(2 bedømmelser)

Hi, I have 10 years of exp. writing bash. I can do this easily. Full comments No release of money without working script. Chat with me.

$100 CAD in 4 dage
(0 bedømmelser)

I am a programmer who did a lot of programming for fun during my nerd years, before I actually came to college. During that time I read a lot about bash scripting, and I think I can easily do this task. As proof of co Flere

$30 CAD in 0 dage
(0 bedømmelser)

This is a good opportunity to write an well documented script to meet your needs. It should not be rushed and it should be awarded to someone dedicated to quality and that knows how to deliver clean scripts. I am sure Flere

$250 CAD in 5 dage
(0 bedømmelser)

I have good experience in this and can deliver as per details mentioned in this project. Please let me know if we can discuss further.

$200 CAD in 7 dage
(0 bedømmelser)