Question: Unix Assignment Question 1. List three common read command options and explain their function. Question 2. How can data from STDIN be sent to both

Unix Assignment

Question 1. List three common read command options and explain their function.

Question 2. How can data from STDIN be sent to both a file and STDOUT?

Read the following shell script and answer the questions:

$cat script1

#!/bin/bash

exec 3<$1

exec 4<$2

exec 5>$3

while read line <&3

do

echo $line >&5

done

while read line <&4

do

echo $line >&5

done

Question 3. The script requires 3 filenames as arguments, e.g., ./script1 file1 file2 file3. Which files are input files and which are output files?

Question 4. Inside the while-loop, why does variable $line have to be enclosed by double quotes?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!