100 Days of DevOps — Day 51-Introduction to Bash Scripting
Welcome to Day 51 of 100 Days of DevOps, Focus for today is Bash Scripting.
Wow, we have completed 50 days and in the last 50 days hopefully, you learned something from it. I would like to thank all of you who read and give your valuable feedback. As you can see from the last 50 days, the main emphasis is AWS and terraform, for the next day it will be a mixed bag of other DevOps Tools(eg: Linux, GIT, Docker, Shell, Python…)
Today I am going to start with a really basic but important thing Shell.
What is Bash?
Bash is the shell, or command language interpreter, for the GNU operating system.
- It acts as an insulating layer between User and Kernel but at the same time its a fairly powerful programming language
- The shell script is particularly helpful for common repetitive tasks or for system admin task which doesn’t require full-blown programming language.
- To verify the shell
$ echo $SHELL/bin/bash
- The /etc/shells is a Linux / UNIX text file which contains the full pathnames of valid login shells
# cat /etc/shells/bin/sh/bin/bash/usr/bin/sh/usr/bin/bash
- Now once you logged in to the system, you will see a prompt like this
For root user
For normal user
- The first field in it, indicate username(root)
- The second field indicates hostname(ip-172–31–31–68)
- The third field indicates the current working directory(~ or root home directory in this case or centos user home directory)
- # prompt is for the root user and $ prompt is for normal user
Default System File which Bash Relies on
- /etc/profile System-wide configuration for Bash
Some important configuration
USER="`/usr/bin/id -un`" <…