There was an error while loading. Please reload this page.
1 parent b98c4f6 commit de2a705Copy full SHA for de2a705
create-gist.sh
@@ -43,12 +43,12 @@ fi
43
44
45
# 1. JSON-Stringify the file content:
46
+# Replace \ with \\
47
# Remove \r (from Windows end-of-lines)
48
# Replace tabs with \t
49
# Replace " with \"
50
# Replace EOL with \n
-# 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") }')
+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')
52
53
# 2. Get the description
54
read -p "Give a description: " DESCRIPTION
0 commit comments