Exercise 7- " | "


I get the following error:
Type the command after the shell prompt.
My code is:
cat < lakes.txt


Some commands can take input both as files and as standard input, what you're doing is to redirect a file to cat's standard input, you're expected to let cat read directly from the file instead.

Python is another example of this:

$ echo "print('hello world')" > hello.py # create a really short python script
$ python hello.py # tell python about the file it should read
hello world
$ python < hello.py # redirect python's standard input to the file
hello world
$ cat hello.py | python # tell cat about the file, and pipe cat's output into python's stdin
hello world


A post was split to a new topic: Exercise 7, terminal freezes