read is a built-in shell command that reads from stdin. See the example below:
$ read war year WWI 1918 $ ./upp.sh $war $year Filename: upp.sh First Argument: WWI Second Argument: 1918 WWI ended in 1918
read created two variables $war and $year. User assigned the values WWI and 1918. These variables were passed as parameter to the program we created in the previous section.
read command is very handy with files. Create a file called data.txt and add the following line to it.
cold-war 1991
Then run the commands as below:
$ read var < data.txt $ ./upp.sh $var
Output
Filename: upp.sh First Argument: cold-war Second Argument: 1991 WWI ended in 1991