Skip to content

Commit de2a705

Browse files
author
Cerem Cem ASLAN
committed
fixes #4
1 parent b98c4f6 commit de2a705

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

create-gist.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ fi
4343

4444

4545
# 1. JSON-Stringify the file content:
46+
# Replace \ with \\
4647
# Remove \r (from Windows end-of-lines)
4748
# Replace tabs with \t
4849
# Replace " with \"
4950
# Replace EOL with \n
50-
# Replace \ with \\
51-
CONTENT=$(echo "${CONTENT}" | sed -e 's/\\/\\\\/g' -e 's/\r//' -e's/\t/\\t/g' -e 's/"/\\"/g' | awk '{ printf($0 "\\n") }')
51+
CONTENT=$(echo "${CONTENT}" | sed -e 's/\\/\\\\/g' -e 's/\r//' -e's/\t/\\t/g' -e 's/"/\\"/g' | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
5252

5353
# 2. Get the description
5454
read -p "Give a description: " DESCRIPTION

0 commit comments

Comments
 (0)