Skip to content

elifyagmurduran/docker-and-bash_scripting-journey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bash scripting exercises 🚀

this repository contains a collection of bash scripting and docker exercises i did, to help practice and improve my bash scripting skills. you can also feel free to use this repository for self-learning.

getting started 🏁

to get started, clone this repository to your local machine:

git clone https://github.com/elifyagmurduran/bash-scripting-exercises.git

exercises overview 📚

the exercises are organized into directories, each focusing on a specific aspect of bash scripting.

bash

bash scripting exercise 1️⃣: hello world

  • write a script that gets your name as an input to get greeted by the bash.

bash scripting exercise 2️⃣: arrays and iteration in bash

develop a bash script that uses arrays and iterates over them.

  • declare an array with at least 5 elements.

  • add two more elements to the array.

  • remove the second element from the array.

  • iterate over the array and print each element.

bash scripting exercise 3️⃣: reading the environment in bash

develop a bash script that reads and manipulates environment variables.

  • print the value of the HOME environment variable.

  • print the value of the PATH environment variable.

  • add a custom directory to the PATH variable.

bash scripting exercise 4️⃣: reading exit codes in bash

develop a bash script that reads and interprets exit codes.

  • run a command that will succeed (e.g., ls).

  • run a command that will fail (e.g., ls /nonexistent).

  • read and print the exit codes of both commands.

bash scripting exercise 5️⃣: using functions and if statements in bash

develop a bash script that uses functions and if statements.

  • create a function that takes a number as an argument.

  • use an if statement inside the function to check if the number is even or odd.

  • call the function with different numbers.

bash scripting exercise 6️⃣: using pipes in bash

develop a bash script that utilizes pipes to combine commands.

  • use ls to list files and pipe it to sort.

  • use echo to print text and pipe it to wc to count words.

bash scripting exercise 7️⃣: using traps in bash

  • use trap to catch the SIGINT signal (ctrl+c).

  • use trap to catch the EXIT signal.

docker

docker exercise 1️⃣: hello world

  • write a docker file that automates a hello world python script.

more coming soon...

license 📝

this project is licensed under the MIT License - see the LICENSE file for details.

Releases

No releases published

Packages

No packages published