Bash_Studying for System Admin
Bash
Bash stands for Bourne Again SHell. It's an upgraded version of the original Unix Shell program, Bourne Shell (sh). • Bash is a command-line interface (CLI) for interacting with an operating system. • Permissions & Execution: Before running a script, you need to make it executable
'chmod +x script.sh'
•to Execute
./script.sh
Basics of a Bash Scripting
• Shebang: Every bash script starts with #!/bin/bash. It tells the system that this file is a Bash script and the location of Bash. • Comments: Lines that begin with # are comments and are not executed.
Sample below:
#!bin/bash
#this is a comment
Why you need to learn Bash Scripting?
• Automate tasks: Instead of manually typing each command every time, you can script a series of commands. • Repetition: Easily perform the same task across many files or servers. • Decision making: Make decisions, e.g., if a certain condition is true, then do this, otherwise do that or do conditionals decisions.