Both of my multiple choise questions are building on the lessons about Shell Pipes and Filters.
Which of the following combination of shell commands will return the
output Welcome
. (If you not familiar with the commands: echo
will
give a string to the standard output; tr
will replace one string by
another one, sort
return sorted lines; tail
will give the last
lines of a given input (-n
specifies the number of lines)).
echo "Welcome to the shell" | tr " " "\n" | sort | tail -n 1
echo "Welcome to the shell" ; tr " " "\n" ; sort ; tail -n 1
echo "Welcome to the shell" > tr " " "\n" > sort > tail -n 1
echo "Welcome to the shell" < tr " " "\n" < sort < tail -n 1
Let us assume we have the plain text file fruits.txt
with the
following 12 lines of content:
peach
apple
banana
orange
avocado
cherry
strawberry
pineapple
blueberry
pear
kiwi
clementine
What will be the outcome of the following commands.
cat fruits.txt | head | wc -l
head
and wc
do not have any input files12
10
10 10 77
What can the different answer tell us about misconception of the student?
|
as standard input.head
will show per default only the first 10
lines of a file.-l
of the command wc
.