Linux Bash Script Basics Shell Scripting #linux #bash #coding

Linux Bash Script Basics Shell Scripting #linux #bash #coding

HomeOther ContentLinux Bash Script Basics Shell Scripting #linux #bash #coding
ChannelPublish DateThumbnail & View CountActions
Channel Avatar Linux Tech Hub2024-06-27 04:30:28 Thumbnail
9,099 Views
Exploring Linux Bash Scripting. Let’s Learn & create your first Bash Script.

Discover the essentials of Linux Bash scripting with our comprehensive tutorial! Learn how to write and execute shell scripts step-by-step, covering basic commands, variables, loops, and more. Perfect for beginners looking to automate tasks and enhance their Linux skills. Join us and master the fundamentals of shell scripting today!

Below is the Bash Script used in the video:

#!/bin/bash

# Ask user to enter 1st number

echo /”Enter the first number: /”
read num1

# Ask user to enter 2nd number

echo /”Enter the second number: /”
read num2

# Perform multiplication
result=$((num1 * num2))

# Display the result
echo /”The multiplication of $num1 and $num2 is: $result/”

Explanation:

1. #!/bin/bash: This line specifies that the script should be interpreted using the Bash shell.

2. echo /”Enter the first number: /”: Outputs a prompt asking the user to enter the first number.

3. read num1: Reads the input from the user and stores it in the variable num1.

Similar steps are repeated for num2.

4. result=$((num1 * num2)): Performs the multiplication of num1 and num2 and stores the result in the variable result.

5. echo /”The multiplication of $num1 and $num2 is: $result/”: Outputs the result of the multiplication, using variables to display the numbers and the result.

#shorts #short #youtubeshorts #linux #linuxcommands #bashscripting #linuxtutorial #techshorts #linuxtips #shell #bash

Please take the opportunity to connect and share this video with your friends and family if you find it useful.