[Solved]Task 1 50 Points Tee Command Reads Standard Input End File Writing Copy Input Standard Out Q37177957
Please do not copy from other questions!!! For my linuxclass!!!!!



Task 1 (50 points) The tee command reads its standard input until end-of-file, writing a copy of the input to standard output and to the file named in its command-line argument. Implement tee using I/O system calls open C), readO, writeO. You can read about tee in its man page: man tee. Example session: $ echo ‘Test Text’ I ./tee outfile Test Text $ cat outfile Test Text Task 2 (50 points) By default, tee overwrites any existing file with the given name. Implement the -a command-line option (tee -a file), which causes tee to append text to the end of a file if it already exists You can read about getopt () function in Appendix B of “The Linux Programming Interface” and in its man page: man 3 getopt Example session (note that position of the option -a does not matter): $ echo TestText1 I ./tee file TestText1 $ cat file TestText1 $ echo TestText2 | ./tee -a file TestText2 $ cat file TestText1 TestText2 $ echo TestText3 I ./tee file -a TestText3 $ cat file TestText1 TestText2 TestText3 Show transcribed image text Task 1 (50 points) The tee command reads its standard input until end-of-file, writing a copy of the input to standard output and to the file named in its command-line argument. Implement tee using I/O system calls open C), readO, writeO. You can read about tee in its man page: man tee. Example session: $ echo ‘Test Text’ I ./tee outfile Test Text $ cat outfile Test Text
Task 2 (50 points) By default, tee overwrites any existing file with the given name. Implement the -a command-line option (tee -a file), which causes tee to append text to the end of a file if it already exists You can read about getopt () function in Appendix B of “The Linux Programming Interface” and in its man page: man 3 getopt Example session (note that position of the option -a does not matter): $ echo TestText1 I ./tee file TestText1 $ cat file TestText1 $ echo TestText2 | ./tee -a file
TestText2 $ cat file TestText1 TestText2 $ echo TestText3 I ./tee file -a TestText3 $ cat file TestText1 TestText2 TestText3
Expert Answer
Answer to Task 1 (50 points) The tee command reads its standard input until end-of-file, writing a copy of the input to standard o… . . .
OR

