LANGUAGE » SHELL_SCRIPT » BASH
Script
Header
shell
#!/bin/bashRead from pipe / stdin
-t 0 is True if file descriptor is open and refers to a terminal. The cat - outputs the input file.
shell
if [[ ! -t 0 ]]; then
stdin=$(cat -)
fiUsing the built-in read:
shell
##!/bin/bash
while IFS= read -r line; do
printf '%s\n' "$line"
doneEval
Evaluates a string as a shell command.
shell
eval ${MYVAR}