Saturday, November 26, 2022

25 Simple Linux Shell Scripts


The following are 25 simple Linux shell scripts that are key for scripting in Linux. The scripts can be utilized for personal, educational or corporate usage. Scripts are simply explained and include step by step instructions for how they can be run. Each script includes useful and common aspects which can be further built out if needed:

Contents:

Common Shells
1) Hello World Script
Writing Simple Shell Scripts
2) Date with WhoAmI Script
3) Date Calendar and Uptime Script
4) Cleanup Script

Simple String Manipulation
5) Simple Replace String Script
Simple Argument Output Scripts
6) Output Arguments
7) Welcome Function Arguments

Simple Text String Scripts
8) Script for Newline and Tabs
Simple Math Script
9) Simple Addition

Simple Case Statements
10) Basic Case Statement
Simple Return Value/String Function Scripts
11) Return Value Function
12) Return String Function

Simple Array Scripts
13) Return Array Values
14) Return Second Element of Array
15) Append Element to Array
16) Return Array Map
17) Remove Array Map Element

IF Statement Scripts
18) IF Conditional Numeric
19) IF Conditional for File
20) IF/Else Conditional for Shell

While Statement Script
21) Simple While Statement
For Loop Scripts
22) Simple For Loop Script
23) Simple For Loop Range Script

Directory Scripts
24) Get Directory
25) Get Files in Directory

Linux Command Line
Permissions

No comments:

Post a Comment