July 2019
Intermediate to advanced
458 pages
12h 12m
English
Different commands can be chained in a sequence when using a shell, making one command output the following command input. For example, consider the following command:
cat book_list.txt | grep "Game" | wc -l
Here, we are displaying a file, using the preceding command to filter rows containing a certain string and, finally, using the filtered output to count the lines.
This can be done programmatically in Go when the processes are created inside the application.
The io.Pipe function returns a reader/writer couple that is connected; whatever gets written to the pipe writer will be read by the pipe reader. The write operation is a blocking one, which means that all of the written data has to be read before a new write operation ...
Read now
Unlock full access