We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20434e1 commit 624ecf5Copy full SHA for 624ecf5
backup.sh
@@ -255,12 +255,14 @@ if [ "$?" -eq 0 ]; then
255
if [ "$?" -ne 0 ]; then
256
exitWithMsg 214 "Grants dump failed"
257
fi
258
- echo ${GRANTS_LIST} | sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/-- \1 --/;/--/{x;p;x;}' > ${BACKUP_DIR}/grants.sql
259
-
+ printf "%s\n" "${GRANTS_LIST}" > ${BACKUP_DIR}/grants.sql
+ # Replace headers to the SQL comment format
260
+ sed -i -E "s/^Grants for (.*)/-- Grants for \1/" ${BACKUP_DIR}/grants.sql
261
+ # Add a ; at each line end
262
+ sed -i -E '/^-- Grants for/! s/^(.*)$/\1;/' ${BACKUP_DIR}/grants.sql
263
264
# Removes double backslashes > \\
265
sed -i -e 's/\\\\//g' ${BACKUP_DIR}/grants.sql
- # echo -e ${GRANTS_SQL}
266
267
268
0 commit comments