

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Help
incomplete
2: Flags
incomplete
3: Positional Arguments
incomplete
4: Exit Codes
incomplete
5: Standard Output
incomplete
6: Standard Error
incomplete
7: Standard In
incomplete
8: Piping
incomplete
9: Unix Philosophy
incomplete
This lesson's interactive features are locked, please to keep using them
One of the most beautiful things about the shell is that you can pipe the output of one program into the input of another program. With this one simple concept, you can run incredibly powerful automation tasks.
The pipe operator is |. It's the character that looks like a vertical line. It's usually on the same key as the backslash (\) above the enter key. The pipe operator takes the stdout of the program on the left and "pipes" it into the stdin of the program on the right.
echo "Have you heard the tragedy of Darth Plagueis the Wise?" | wc -w
# 10
In the example above, the echo command sends "Have you heard the tragedy of Darth Plagueis the Wise?" to stdout.
However, instead of that text being sent to your terminal, the pipe operator pipes it into the wc (word count) command. The wc command counts the number of words in the input it receives. The -w flag tells wc to only count words.
This only works because the wc command, like most shell commands, can optionally read from stdin instead of a filepath argument.
We need to figure out just how many transactions "Bob" has been involved in... Bob's looking sus fr.
grep -R "TEXT_TO_FIND" PATH_TO_TRANSACTIONS_DIR --exclude-dir="DIR_TO_EXCLUDE"
Submit the shell checks.
The answer is 3973. If your number is off, double-check that you used --exclude-dir="backups" (otherwise you'll also count the duplicate transactions in the backups directory) and that you searched the whole transactions directory.