In: Computer Science
#BASH Script To ask the Details of the student and then print
out in a statement
echo "Enter your first name"
read FIRST
echo "Enter your last name"
read LAST
echo "Enter your Age"
read AGE
echo "Enter your Country of origin"
read COUNTRY
echo "The details of the student are:
The Full name is $FIRST $LAST,
The age of the stdent is $AGE,
The country of origin is $COUNTRY. "
The above script is run to fulfill the requirements of this question. BASH stands for Bourne-Again Shell. It has multiple variable that are responsible to pick the values which are provided by the user. The above script begins with a comment that describes the function of the script which in this case was to use Bourne Shell Scripting language to write a script that asks the First Name, Last Name,Age and Country of origin of the student and then print out these items in a statement for the user to view it.
There are a few concepts of BASH that were used here such as Comment, Variable, echo, read.The name of the variable used are $FIRST $LAST,$AGE,$COUNTRY in the script that we have written. Here we notice that we don't need to pre-define these variables in the program we declare them when we need them which is the case for most of the scripting languages. The echo command is used to display line(s) of text to the console which is considered to be the output of the code. The echo command is a built in command in the BASH shell scripting scenario. Similarly, The read command is used to read input in the form text or string or numbers which is given by the user. So basically it takes input from the keyboard. The read command is a built in command in the BASH shell scripting scenario.