Practice Questions
Question 1
Match the symbols with what they do:
>
<
>>
|
2>
- Pipe standard output from one program to another program’s standard input
- Redirect standard error output (in some shells)
- Redirect standard output to a file and overwrite it
- Redirect standard output to a file and append to it
- Redirect standard input to be from a file
Question 2
What is stored in file.txt
after the following commands
are run? Think about what each command does, and think back to Fortnight 6 of
COMP 1002 to figure out how you’d learn more about each. You may
need to log on to Aviary to see the contents of
/usr/share/dict/words
.
echo "hello " > file.txt
head -10 /usr/share/dict/words | grep 's$' | wc -l >> file.txt