Bash stdin (Standard Input)
stdin (standard input, file descriptor 0) is where a command reads its input.
By default it is the keyboard, but you can feed it from a file with < or from another command with a pipe.
Read stdin from a file
cat names.txt
Tove
Jani
Linus
sort < names.txt
Jani
Linus
Tove
Feed a script through a pipe
Save this as hello.sh:
#!/bin/bash
read name
echo "Hello, $name!"
Run it:
echo "Tove" | ./hello.sh
Hello, Tove!