Bash Scripting Programs
1>$ nano First.sh
Add the following bash script to the file and save the file.
#!/bin/bash
echo "Hello World"
$ chmod a+x First.sh
$ ./First.sh
o/p -> Hello World
2> How to read user input
In bash, we can take user input using the read
command.
read variable_name
To prompt the user with a custom message, use the -p
flag.
read -p "Enter your age" variable_name
Example:
#!/bin/bash
echo "Enter a numner"
read a
echo "Enter a numner"
read b
var=$((a+b))
echo $var