Last active
September 13, 2021 18:45
-
-
Save lbvf50mobile/e34e8e7c1fe0e2dab1ddda0d2b8b38b0 to your computer and use it in GitHub Desktop.
Bash wrapper for @eifgr
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 | |
# Help for @eifgr at Sunday September 2021.09.12. | |
# Usage: echo 'abc def ghi' | xargs -0 ./wrapper.sh > output.txt | |
# cat input.txt | xargs -0 ./wrapper.sh > output.txt | |
# Do not forget to set execution right for the script. | |
# chmod u+x wrapper.sh | |
HEADER='{{#inline "content" }}' | |
FOOTER_1='{{/inline}}' | |
FOOTER_2='{{>partials/basis}}' | |
NEWLINE='\n' | |
# https://stackoverflow.com/questions/20536112/how-to-insert-a-new-line-in-linux-shell-script/20538015 | |
# https://stackoverflow.com/questions/54218833/pass-multiline-argument-with-xargs | |
echo -e "$HEADER${NEWLINE}$1${NEWLINE}$FOOTER_1${NEWLINE}$FOOTER_2" |
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 | |
# !!!!!!! This code has problems !!!!!!! | |
# Help for @eifgr at Sunday September 2021.09.12. | |
# Usage: echo 'abc def ghi' | ./wrapper_stdin.sh > output.txt | |
# cat input.txt | ./wrapper_stdin.sh > output.txt | |
# Do not forget to set execution right for the script. | |
# chmod u+x wrapper.sh | |
HEADER='{{#inline "content" }}' | |
FOOTER_1='{{/inline}}' | |
FOOTER_2='{{>partials/basis}}' | |
NEWLINE='\n' | |
echo -e "$HEADER" | |
# https://stackoverflow.com/a/33234042/8574922 | |
full="" | |
while read line | |
do | |
full="$full$line\n" | |
done | |
printf $full | |
echo -e "$FOOTER_1${NEWLINE}$FOOTER_2" |
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 | |
# Help for @eifgr at Sunday September 2021.09.12. | |
# Usage: echo 'abc def ghi' | ./wrapper_stdin.sh > output.txt | |
# cat input.txt | ./wrapper_stdin.sh > output.txt | |
# Do not forget to set execution right for the script. | |
# chmod u+x wrapper.sh | |
# Code by @Fearan. | |
cat <<EOF | |
{{#inline "content" }} | |
$(cat) | |
{{/inline}} | |
{{>partials/basis}} | |
EOF |
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 | |
# Help for @eifgr at Sunday September 2021.09.12. | |
# Usage: echo 'abc def ghi' | ./wrapper_stdin.sh > output.txt | |
# cat input.txt | ./wrapper_stdin.sh > output.txt | |
# Do not forget to set execution right for the script. | |
# chmod u+x wrapper.sh | |
HEADER='{{#inline "content" }}' | |
FOOTER_1='{{/inline}}' | |
FOOTER_2='{{>partials/basis}}' | |
NEWLINE='\n' | |
echo -e "$HEADER" | |
# https://stackoverflow.com/a/33234042/8574922 | |
full="" | |
while read line | |
do | |
echo $line | |
done | |
echo -e "$FOOTER_1${NEWLINE}$FOOTER_2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment