See the fallowing example. Note the use of ()
after +=
.
#!/bin/bash
#Plugins: #AFC | #itsecurity | ...
#https://www.linuxjournal.com/content/bash-arrays
UPDATEFILE=y
if [ "$UPDATEFILE" = "y" ]
then
PLUGINARR=()
PLUGINARR+=('https://downloads.wordpress.org/plugin/advanced-custom-fields.5.10.2.zip')
PLUGINARR+=('https://downloads.wordpress.org/plugin/better-wp-security.8.0.2.zip')
PLUGINARR+=('https://downloads.wordpress.org/plugin/better-wp-security.8.0.2.zip')
PLUGINARR+=('https://downloads.wordpress.org/plugin/all-in-one-wp-migration.7.48.zip')
for PLUGIN in ${PLUGINARR[*]}
do
printf " %s\n" $PLUGIN
BASENAME=$(basename -- $PLUGIN)
wget -q -O $BASENAME $PLUGIN || curl -O $PLUGIN
done
fi
#Unzip all zip files