Last active
October 19, 2019 18:15
-
-
Save lbvf50mobile/c077f2ee86acc5e72a6c5ab342a88f5c to your computer and use it in GitHub Desktop.
@liso_soma task about redirection
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
echo "alias x='bash 20191020_Sunday/20191020.sh'" | |
# $ echo "test" | x test.output | |
# https://stackoverflow.com/a/7045517/8574922 | |
# https://stackoverflow.com/a/28786207/8574922 | |
# https://stackoverflow.com/a/1809910/8574922 | |
# https://stackoverflow.com/a/17336953/8574922 | |
# https://stackoverflow.com/a/17336953/8574922 | |
# https://stackoverflow.com/questions/17336915/return-value-in-a-bash-function | |
# https://ryanstutorials.net/bash-scripting-tutorial/bash-functions.php | |
function encoder(){ | |
echo "${1}!" | |
} | |
while IFS= read -r line | |
do | |
line=$(encoder $line) | |
if [ -z "$1" ] | |
then | |
echo $line | |
else | |
echo $line >> $1 | |
fi | |
done |
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
echo "alias x='bash 20191020_Sunday/20191020.sh'" | |
# $ echo "test" | x test.output | |
# https://stackoverflow.com/a/7045517/8574922 | |
# https://stackoverflow.com/a/28786207/8574922 | |
while IFS= read -r line | |
do | |
if [ -z "$1" ] | |
then | |
echo $line | |
else | |
echo $line >> $1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment