Created
November 11, 2014 18:11
-
-
Save jmakeig/418a6036239ff215bab6 to your computer and use it in GitHub Desktop.
Pipe input or get from param
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
#!/usr/bin/env bash | |
# From <http://linux.byexamples.com/archives/474/bash-script-that-process-input-from-pipeline-or-file-redirection/> | |
# If there is not param read from stdin else get from the input | |
# TODO: Get input from a specific parameter inline or from a file specified in a parameter. | |
if [ -e $1 ] ;then read str; else str=$1;fi | |
echo "$str" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment