Assignment 2: Bash
Now let’s get acquainted with script programming in Bash.
Much is about simplifying everyday life, as a programmer, by automating the processes and routines you perform. A lot of what we do can be automated through scripts, such as Bash scripts with commands. But to do that, we need to keep track of how to create scripts and how to program in Bash.
You also need to have a pretty good look at common commands in the Linux terminal. There are commands that are powerful and if we only learn a couple of these commands they can save a lot of time for us.

Let’s get started with script programming in Bash.
#Reading
(ca: 10 study hours)
#Course literature
DV1563 Read the following:
- The Linux Command Line
- Ch1 What Is The Shell?
- Ch2 Navigation
- Ch3 Exploring The System
- Ch4 Manipulating Files And Directories
- Ch6 Redirection
- Ch24 Writing Your First Script
DV1466 Read the following:
- A Practical Guide to Ubuntu Linux (3rd edition)
- Part 3 Digging into Ubuntu Linux
- Ch8 Linux GUI
- Ch9 Bourne Again Shell
- Part 3 Digging into Ubuntu Linux
#Bash Guide
Kenneth has created a Bash guide showing common commands and structures in the Bash programming language and how to use the commands and structures.
#Reading tip
- There is a reference guide for Bash. Have it in mind.
#Exercises & Assignments
(ca: 10 study hours)
#Exercises
- Work through how you can use Bash to create a more advanced command line program that takes arguments. The article “Create Bash-script with options, commands and arguments” gives you a structure on how to create more advanced and larger Bash scripts.
#Assignments
These assignments are to be completed and handed in.
Read the instructions and do the labs
bash1
andbash2
.Do “My first Bash script”.
#Hand In
(ca: 2 study hours)
When you have completed all assignments above do the following command to publish all code to the student server.
dbwebb publish me
Then on the education platform Canvas do a hand in for assignment 2 with a text containing reflective answers to the questions below.
- Is this your first acquaintance with script programming in Bash?
- Tell us about your perception of Bash as a programming environment, relate to other programming languages you know.
- What opportunities/challenges do you see with this type of script programming?
- Was it something that was extra difficult or challenging in the tasks?
Your grade on this assignment and points towards the final grade is given based on the following criteria:
Grade | Final grade points | Assignments | Reflective answers | Extra assignments in labs |
---|---|---|---|---|
A | 20 | X | X | X |
C | 15 | X | X OR | X |
E | 10 | X | ||
F | 0 |
As a last text describe what you have done in this assignment and make an argument for the grade you deserve. The grading of your assignment will use this text as the starting point.
#Revision history
- 2019-08-20: (A, lew, efo) First edition.