A collection of automation scripts, productivity hacks, self-made challenge walkthroughs and solutions to interview exercises related to DevOps, Linux System Administration and Developer Tools.
- Plenty of Bashful (understandably blushy) shells
waiting to be noticed - Solutions to interview problems and exercises
- A petty attempt to promote the fun of shell scripting ๐ค
- Generator scripts (that bootstraps the test environment to solve the corresponding problem)
- A constant reminder to myself that I don't need to reinvent the wheel everytime I rediscover the same issue
๐ Note to self: Remember that ugly script you wrote scratching the head for two hours last week? It's never too late push that over here!
Regardless of the environment you may have, chances are rare that you have to compile bash from source. A bash shell can be accessed through following means:
- GNU/Linux based Distros (Preinstalled)
- Git Bash for Windows (for lifeless maniacs)
- Online Bash Interpreter
devops-exercises contains a comprehensive list of exercises to skill-up in DevOps domain. Here's my take on the shell scripting problems.
Serial | Name | Problem Description | Solution |
---|---|---|---|
1 | Hello World | Exercise | Solution |
2 | Basic date | Exercise | Solution |
3 | Great Day | Exercise | Solution |
4 | Factors | Exercise | Solution |
5 | Argument Check | Exercise | Solution |
6 | Files Size | Exercise | Solution |
7 | Count Chars | Exercise | Solution |
8 | Sum | Exercise | Solution |
9 | Number of Arguments | Exercise | Solution |
10 | Empty Files | Exercise | Solution |
11 | Directories Comparison | Exercise | Solution |
12 | It's alive! | Exercise | Solution |
-
Run the
generator.sh
script to create a folder hierarchy of all the problems with a ready for you to tackle! Executing the script will:- create a subdirectory for each of the challenges
- create a fresh template file
script.sh
under each of the subdirectories
โ Some of my problem directories contain additional
init.sh
script. Copy that into your corresponding location and run it to generate the test environment for that particular problem -
As a bonus, you'll find additional scripts in few of my solutions. Those are the bash concepts / topics that I discovered / tried out before implementing them on the corresponding solution.
-
For better understanding, my personal approach to the problems is enclosed in
function mysolve()
, whereas the intended solution can be found underfunction actualsolve()
.
The Linux Shell module by HackerRank has some interesting text processing problems regarding commands like awk
, cut
, grep
, head
, sort
, tr
, uniq
, paste
, sed
etc.
Serial | Name | Problem Description | Solution |
---|---|---|---|
1 | Middle of a Text File | Exercise | Solution |
2 | Looping and Skipping | Exercise | Solution |
3 | Compute the Average | Exercise | Solution |
4 | Slice an Array | Exercise | Solution |
5 | Filter an Array with Patterns | Exercise | Solution |
6 | Display Nth word | Exercise | Solution |
7 | Dlt a set of chars | Exercise | Solution |
A portion of the scripts are based on the problems from various online sources. The originality and copyright of those problem descriptions and corresponding sample data are created by the respective authors and platform owners.
This collection highlights contents from following modules: