diff --git a/1-introduction-to-bash/1.sh b/1-introduction-to-bash/1.sh index b044642..ba27a41 100755 --- a/1-introduction-to-bash/1.sh +++ b/1-introduction-to-bash/1.sh @@ -3,7 +3,7 @@ # Author: Samir M. # Date: 2024-02-29 # Modified: 2024-02-29 -# Description: Comprehensive Bash Scripting Tutorial +# Description: A simple Bash script to print system information. # Usage: ./1.sh # Introduction @@ -20,57 +20,12 @@ echo " Current Date and Time: $(date)" echo " System PATH: $PATH" echo " Hostname: $(hostname)" -# File and Directory Operations -# e flag is used to enable interpretation of backslash escapes -echo -e "\n2. File and Directory Operations:" -# Create a directory -mkdir my_directory -echo " Created 'my_directory'" -# Change to the directory -cd my_directory -echo " Current Directory: $(pwd)" -# Create a new file -touch my_file.txt -echo " Created 'my_file.txt'" -# Display file content -echo -e "\n Content of 'my_file.txt':" -cat my_file.txt -# Delete the file -rm my_file.txt -echo " Deleted 'my_file.txt'" -# Delete the directory -cd .. -rm -r my_directory -echo " Deleted 'my_directory'" - -# Process Information -echo -e "\n3. Process Information:" -# Display process information -echo " List of processes:" - -# ps aux command is used to display all the running processes -ps aux - -# User Input -echo -e "\n4. User Input:" - -# Prompt for user input -read -p "Enter your name: " user_name - -echo " Hello, $user_name! Welcome to Bash scripting." - -# Make the script executable -# To calculate the permission, we use the following webiste: https://chmod-calculator.com/ -# chmod 744 1.sh - -# Execute the script -# ./1.sh diff --git a/1-introduction-to-bash/2.sh b/1-introduction-to-bash/2.sh new file mode 100755 index 0000000..d30c79e --- /dev/null +++ b/1-introduction-to-bash/2.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Author: Samir M. +# Date: 2024-02-29 +# Modified: 2024-02-29 +# Description: A simple Bash script to demonstrate file and directory operations. +# Usage: ./2.sh + +# File and Directory Operations +# e flag is used to enable interpretation of backslash escapes +echo -e "\n2. File and Directory Operations:" + +# Create a directory +mkdir my_directory +echo " Created 'my_directory'" + +# Change to the directory +cd my_directory +echo " Current Directory: $(pwd)" + +# Create a new file +touch my_file.txt +echo " Created 'my_file.txt'" + +# Display file content +echo -e "\n Content of 'my_file.txt':" +cat my_file.txt + +# Delete the file +rm my_file.txt +echo " Deleted 'my_file.txt'" + +# Delete the directory +cd .. +rm -r my_directory +echo " Deleted 'my_directory'" \ No newline at end of file diff --git a/1-introduction-to-bash/3.sh b/1-introduction-to-bash/3.sh new file mode 100755 index 0000000..751542c --- /dev/null +++ b/1-introduction-to-bash/3.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Author: Samir M. +# Date: 2024-02-29 +# Modified: 2024-02-29 +# Description: A simple Bash script to print process information. +# Usage: ./3.sh + + +# Process Information +echo -e "\n3. Process Information:" +# Display process information +echo " List of processes:" + +# ps aux command is used to display all the running processes +ps aux \ No newline at end of file diff --git a/1-introduction-to-bash/4.sh b/1-introduction-to-bash/4.sh new file mode 100755 index 0000000..b90547f --- /dev/null +++ b/1-introduction-to-bash/4.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Author: Samir M. +# Date: 2024-02-29 +# Modified: 2024-02-29 +# Description: A simple Bash script to demonstrate user input. +# Usage: ./4.sh + +# User Input +echo -e "\n4. User Input:" + +# Prompt for user input +read -p "Enter your name: " user_name + +echo "Hello, $user_name! Welcome to Bash scripting." \ No newline at end of file diff --git a/1-introduction-to-bash/5.sh b/1-introduction-to-bash/5.sh new file mode 100755 index 0000000..4fa7a2e --- /dev/null +++ b/1-introduction-to-bash/5.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Author: Samir M. +# Date: 2024-02-29 +# Modified: 2024-02-29 +# Description: A simple Bash script to make the script executable. +# Usage: ./5.sh + +# Make the script executable +# To calculate the permission, we use the following webiste: https://chmod-calculator.com/ +# chmod 744 1.sh +