I have written the script below, but when I run it from the directory where it is (and also the files)
bash xmlimport-magento2.sh
I get this error message:
xmlimport-magento2.sh: line 7: syntax error near unexpected token $'do\r''
mlimport-magento2.sh: line 7: do
#!/bin/bash
if exists *.ZIP
then
# disable autoindexing
#php -f "$MAGEPATH"shell/indexer.php -- --mode-manual all
for file in `ls *.ZIP`
do
# Backup zip file
cp $file /backups
# Extract XML files
unzip -P web $file
# Delete zip file
rm -f $file
# rename xml files
# hier komt procedure die controleert of bestand xxx*basic.xml bestaat en zo ja dan wordt dit bestand hernoemt en daarna geexecuteerd
if [ -f "*basic.xml" ]
then
mv *_BASIC.XML BASIC.XML
php -f bin/magento import:job:run 1
fi
# rename xml files
# hier komt procedure die controleert of bestand xxx*prices.xml bestaat en zo ja dan wordt dit bestand hernoemt en daarna geexecuteerd
if [ -f "*prices.xml" ]
then
mv *_PRICES.XML PRICES.XML
php -f bin/magento import:job:run 4
php -f bin/magento import:job:run 2
fi
# rename xml files
# hier komt procedure die controleert of bestand xxx*stock.xml bestaat en zo ja dan wordt dit bestand hernoemt en daarna geexecuteerd
if [ -f "*stockinfo.xml" ]
then
mv *_STOCKINFO.XML STOCKSTOCK.XML
php -f bin/magento import:job:run 3
fi
done
# verplaats .XML files naar backup
cp -f $file ../backups
# Delete XML files
rm -f *.XML
fi