Chapter 6 Challenges
- Decide whether the following sentence is true or false:
- To create empty file use >filename.
- If no files given cat command reads from standard input.
- The standard input defaults to user keyboard.
- 0<filename takes standard input from file.
- 2>filename puts standard output to file.
- ./script.sh 2>&1 puts standard error to current destination of standard output.
- >output.txt if output.txt doesn't exist it is created and if it exist it is overwritten.
- The order in which you place redirection is significant.
- The following command will generate an error message -
</etc/passwd grep vivek
- The following two commands will produced the same results:
sort < input.txt > output.txt sort > output.txt < input.txt
- Write a shell command that associates the file descriptor 2 to a file called log.txt and send fd # 2 to a log.txt instead of the screen. Then associates fd # 1 with the file associated with the fd # 2.
- Write a shell script to open /etc/passwd file using fd (input) and copy the same to /tmp/passwd.output file using file descriptor (output).