Welcome to the Bash Scripting Repository! This repository contains various Bash scripts for automating tasks and managing system operations, as part of an introduction to Bash scripting.
This repository is designed to provide useful Bash scripts for system administrators and users who want to automate common tasks. Each script is self-contained and includes instructions for use.
- 01_CreateDirectories.sh: A script to create multiple directories.
- 02_Variable.sh: Demonstrates the use of variables in Bash.
- 03_DataTypes.sh: Explains different data types in Bash scripting.
- 04_Var_SystemDefined.sh: Shows how to use system-defined variables.
- 05_Var_UserDefined.sh: Illustrates user-defined variables.
- 06_Var_SpecialVariable.sh: Discusses special variables in Bash.
- 07_Prob_backupscript.sh: A script that creates a backup of specified files.
- 08_ArithmeticOperators_().sh: Demonstrates arithmetic operations using parentheses.
- 09_ArithmeticOperators_expr.sh: Shows arithmetic operations using the
exprcommand.
- 10_IF_NumberComp.sh: A script that uses
ifstatements for number comparison. - 11_IFelse_NumberComp.sh: Demonstrates the use of
if-elsestatements for number comparison.
- 12_FileComp.sh: A script that compares files and outputs the differences.
- 13_Loops.sh: Introduces looping constructs in Bash, such as
for,while, anduntil.
- 14_ConditionalStment.sh: Explores additional conditional statements in Bash.
- 16_DataStreams.sh: Discusses data streams in Bash, including standard input, output, and error.
- 17_Functions.sh: Introduces functions in Bash scripting.
- Description: This script creates a backup of all
.txtfiles in the current directory and appends the current date and time to the filenames. - Usage: Run the script in the directory containing the
.txtfiles.
- Description: This script checks the system's CPU and memory usage, reporting if the CPU usage is above 80% or if available memory is below 20%. Results are logged to
system_health.log. - Usage: Run the script in a terminal to perform the health check.
- Description: This script reads a list of usernames from
user_list.txt, creates new users, generates random passwords, and saves the credentials tocredentials.txt. - Usage: Ensure you have a
user_list.txtfile with usernames, then run the script with superuser privileges.
To use any of the scripts in this repository, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/ShreyasBh02/bash-scripting-repo.git