In: Computer Science
If you have a script called testscr, that you execute with the following pipeline:
echo two four six eight ten | testscr
and testscr contains the following lines of code:
# This is a read test
read parm1 parm2 parm3
echo :$parm1:$parm2:$parm3:
What gets printed?
PLEASE FIND THE
ANSWER(S) and EXPLANATION BELOW.
We will get :two:four:six eight ten: as the output.
EXPLANATION:
In the command echo two four six eight ten | testscr , the pipe operator will pass the output of left side command to the right side command.
echo two four six eight ten has the output "two four six eight ten"
This will be passed as the input to the script testscr.
Hence,
The line: read parm1 parm2 parm3 will read the data into respective params.
echo :$parm1:$parm2:$parm3: command line will print the output as
:two:four:six eight
ten:

