Skip to content

Commit

Permalink
initail commit
Browse files Browse the repository at this point in the history
  • Loading branch information
samirm00 committed Mar 1, 2024
1 parent 4428e1d commit db6b308
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 46 deletions.
47 changes: 1 addition & 46 deletions 1-introduction-to-bash/1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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



36 changes: 36 additions & 0 deletions 1-introduction-to-bash/2.sh
Original file line number Diff line number Diff line change
@@ -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'"
16 changes: 16 additions & 0 deletions 1-introduction-to-bash/3.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions 1-introduction-to-bash/4.sh
Original file line number Diff line number Diff line change
@@ -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."
12 changes: 12 additions & 0 deletions 1-introduction-to-bash/5.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit db6b308

Please sign in to comment.