I have a .bash_aliases
file I've been using for a long time. Today I added some commands that are broken into multiple lines (using \
).
Since doing that, I can't source
the file to reload it. When I do it gets stuck. It just sits there, with a flashing cursor on a new line, and doesn't return me to the command prompt.
Initially doing the source
command would return the following error (which I'd not had prior to adding the multi-line commands)
-bash: alias: date: not found
-bash: alias: +%Y-%m-%d-%H.%M.%S: not found
So I changed the line:
/home/waiheke26/sites/www.waihekehoney.co.nz/backups/wp-files-$(date +%Y-%m-%d-%H.%M.%S).tar.gz \
to
'/home/waiheke26/sites/www.waihekehoney.co.nz/backups/wp-files-$(date +%Y-%m-%d-%H.%M.%S).tar.gz' \
That stopped that error.
But now when I run source ~/.bash_aliases
it just sits with a flushing cursor.
UPDATE:
I added a missing "
as noted by Spiff in the comments. But now I get these errors when doing a source on the file:
-bash: alias: backup: not found
-bash: alias: OK || echo Database: not found
-bash: alias: backup: not found
-bash: alias: failed: not found
I've gone through the file, and I can't see what the issue is.
QUESTION: What is causing this .bash_aliases
file to not update when sourced?
Here's the file (domain name removed)
alias bashupdate="source ~/.bash_aliases";
alias aliases="cat ~/.bash_aliases";
alias wphome="cd /home/waiheke26/sites/www.waihekehoney.co.nz/public";
alias wpsyncfolder="cd /waiheke26/sites/www.waihekehoney.co.nz/backupsync";
alias wpsync="wphome && rsync -va --exclude 'cache' \
--exclude 'wp-content/uploads' \
--exclude 'wp-content/cache' \
--exclude 'wp-content/uploads' \
--exclude 'wp-content/backups' \
--exclude 'wp-content/envato-backups' \
/home/waiheke26/sites/www.waihekehoney.co.nz/public/ \
/home/waiheke26/sites/www.waihekehoney.co.nz/backupsync/public/ --delete";
alias wptar="wpsyncfolder && tar -zcf \
'/home/waiheke26/sites/www.waihekehoney.co.nz/backups/wp-files-$(date +%Y-%m-%d-%H.%M.%S).tar.gz' \
. \
&& echo 'File backup OK' || echo 'File backup failed'";
alias wpbackup="dbbackup && wpsync && wptar && cleanbackups";
# alias wpbackup="wphome && tar --exclude='./wp-content/uploads' --exclude='./wp-content/cache' --exclude ='./cache' --exclude='./wp-content/backups' --exclude='./wp-snapshots' --exclude='./wp-content/envato-backups' -zcf /home/waiheke26/sites/www.waihekehoney.co.nz/backups/wp-files-$(date +%Y-%m-%d-%H.%M.%S).tar.gz . && echo "File backup OK" || echo "File backup failed"';
alias dbbackup="wphome && wp db export --add-drop-table && mv *.sql /home/waiheke26/sites/www.waihekehoney.co.nz/backups/ && echo "Database backup OK" || echo "Database backup failed"";
alias cleanbackups="find /home/waiheke26/sites/www.waihekehoney.co.nz/backups -mtime +7 -delete";
alias cleanbackups-test="find /home/waiheke26/sites/www.waihekehoney.co.nz/backups -mtime +7 -print";
alias wpdbbackup="wpbackup && dbbackup && cleanbackups";
wpsync
dbbackup
. You either need to escape the doublequotes around "Database backup okay" and "Database backup failed", or change them to single quotes.