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.
to get started, clone this repository to your local machine:
git clone https://github.com/elifyagmurduran/bash-scripting-exercises.git
the exercises are organized into directories, each focusing on a specific aspect of bash scripting.
- write a script that gets your name as an input to get greeted by the 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.
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.
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.
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.
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.
-
use trap to catch the SIGINT signal (ctrl+c).
-
use trap to catch the EXIT signal.
- write a docker file that automates a hello world python script.
this project is licensed under the MIT License - see the LICENSE file for details.