mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
2.2 KiB
35 lines
2.2 KiB
6 years ago
|
## cat
|
||
6 years ago
|
|
||
6 years ago
|
### Instructions
|
||
6 years ago
|
|
||
5 years ago
|
Write a program that behaves like a simplified `cat` command.
|
||
6 years ago
|
|
||
5 years ago
|
- The options do not have to be handled.
|
||
6 years ago
|
|
||
5 years ago
|
- If the program is called without arguments it should take the standard input (stdin) and print it back on the standard output (stdout).
|
||
6 years ago
|
|
||
6 years ago
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ echo '"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing' > quest8.txt
|
||
|
student@ubuntu:~/[[ROOT]]/cat$ cat <<EOF> quest8T.txt
|
||
|
"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
|
||
|
EOF
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/cat$ ./cat abc
|
||
5 years ago
|
ERROR: abc: No such file or directory
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ ./cat quest8.txt
|
||
6 years ago
|
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ ./cat quest8.txt abc
|
||
|
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
|
||
|
ERROR: abc: No such file or directory
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ cat quest8.txt | ./cat
|
||
|
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ ./cat
|
||
5 years ago
|
Hello
|
||
5 years ago
|
Hello
|
||
|
^C
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$ ./cat quest8.txt quest8T.txt
|
||
6 years ago
|
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
|
||
|
"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cat$
|
||
6 years ago
|
```
|