Created
October 4, 2019 07:58
-
-
Save abdennour/78e1f8ada01cd85e77d06bec9aa8f201 to your computer and use it in GitHub Desktop.
Bash script reads from pipe, stdin < or first argument
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
#!/bin/bash | |
# Available SYNTAX: | |
# --- $0 /path/file | |
# --- $0 < /path/file | |
# --- echo "my content" | $0 | |
# either comes from first argument or from /dev/stdin. | |
content_to_replace="${1:-/dev/stdin}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment