Last active
March 12, 2024 11:06
-
-
Save CMCDragonkai/451d2c2b3d36a0eaf350 to your computer and use it in GitHub Desktop.
BASH: Ways of Piping/Redirection and Heredoc Demonstration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shells are an orchestration environment | |
# the language they provide is intended to orchestrate processes | |
# on the operating system | |
# if programs are functions, then all of the below are variants of function application | |
# anonymous pipe | |
echo "string" | cat | |
# herestring | |
cat <<< "string" | |
# herestring with command substitution | |
cat <<< $(echo "string") | |
# redirect stdin from process substitution | |
cat < <(echo "string") | |
# heredoc | |
cat << EOF | |
string | |
EOF | |
# heredoc ignoring leading tabs on each line | |
cat <<- EOF | |
string | |
EOF | |
# heredoc literal - ignores interpolation and evaluation | |
cat << 'EOF' | |
$string | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
heredoc with pipe