add support for OSX

when substituting "in place" with the -i flag using the sed in Mac OS X,
you are required to supply an extension for backing up the file.
This commit is contained in:
Kada
2017-08-07 11:04:11 +08:00
parent 9205984cbc
commit cbe3132789
+6 -1
View File
@@ -1,4 +1,9 @@
_os="`uname`"
_now=$(date +"%m_%d_%Y")
_file="wp-data/data_$_now.sql"
docker-compose exec db sh -c 'exec mysqldump "$MYSQL_DATABASE" -uroot -p"$MYSQL_ROOT_PASSWORD"' > $_file
sed -i 1,1d $_file # Removes the password warning from the file
if [[ $_os == "Darwin"* ]] ; then
sed -i '.bak' 1,1d $_file
else
sed -i 1,1d $_file # Removes the password warning from the file
fi