Berharap seseorang di sini dapat membantu saya dengan skrip bash yang hanya berjalan pada kondisi tertentu.
#!/bin/bash
TODAY=`date +%Y-%m-%d`
MODE=$1
if [ $(date '+%A') == "Sunday" ] || [ $(date '+%d') == "01" ] || [ $MODE == 'Complete']
then
echo "Running backup as it is the either a Sunday the 1st of the Month or the script was called with the paramater 'Complete'."
/usr/bin/7z a -t7z -m0=lzma -mx=9 /external-storage/snapshots/snapshot-complete-"$TODAY"-public_html.7z /local-storage/www/public_html > /dev/null
fi
Ketika saya mencoba menjalankan di atas saya mendapatkan kesalahan.
line 4: [: missing `]'
Setiap tips akan dihargai, terima kasih sebelumnya.