#!/bin/bash
echo "Enter a number to be converted."
read number
feet = $(($number*12))
echo "feet conversion to inches ="$feet
Explanation -
1. #!/bin/bash - this tells the system that the following commands are to be executed by Bourne Shell. (Also known as the shebang, the # is called a hash, and the ! is called a bang).
2. echo "Enter a number to be converted." - this (i.e., 'echo') is used for displaying lines of text or string passed as an argument on the command line.
3. read number - read here is a command to read the input from the keyboard and assign it as the value of the variable number
4. feet = $(($number*12)) - here the '=' operator indicates that e are assigning the calculated value from right into the variable on the left.
And calculation for feet to inches is fairly simple -
1 feet = 12inches
n number of feet = n x 12 inches
5. echo "feet conversion to inches ="$feet - the echo will print the passed argument string onto the command line.
(We use the $ sign with a variable to determine if it is a variable we can use in an expression or as an argument to another method. )