do not mangle space in while read line loop

This commit is contained in:
BarbUk 2018-05-23 18:01:41 +04:00
parent 749b08929b
commit 9658cc1405

2
snippy
View File

@ -60,7 +60,7 @@ MENU_ARGS=${DMENU_ARGS}
# fetches a document and interprets bashsyntax in string (bashdown) templates # fetches a document and interprets bashsyntax in string (bashdown) templates
# @param string - string with bash(down) syntax (usually surrounded by ' quotes instead of ") # @param string - string with bash(down) syntax (usually surrounded by ' quotes instead of ")
bashdown(){ bashdown(){
while read -r line; do while IFS= read -r line; do
line="$(eval "printf -- \"$( printf "%s" "$line" | sed 's/"/\\"/g')\"")"; line="$(eval "printf -- \"$( printf "%s" "$line" | sed 's/"/\\"/g')\"")";
echo -e "$line" echo -e "$line"
done done