From cbe3132789d0975564dbd4271e9c66c55b4175f2 Mon Sep 17 00:00:00 2001 From: Kada Date: Mon, 7 Aug 2017 11:04:11 +0800 Subject: [PATCH] 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. --- export.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/export.sh b/export.sh index 7d2ab97..547f0f8 100755 --- a/export.sh +++ b/export.sh @@ -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 \ No newline at end of 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 \ No newline at end of file