These are very old and will not work with modern versions of browsers. I wrote these quite a few years ago to automate exporting the history databases and files to be reviewed at a later time. Although they are obsolete I am positing them here for a reference.
#!/bin/bash
# Creates a unique variable containing the time and day the script was run.
# This is used in the creation of the file path
dateTime=$(date +"%m%d%y-%H%M%S")
#Creates a variable to find the location of the script to create the destination folder
scriptDir=$(dirname "$0")
#Displays warning and waits for user input
echo
echo "***********************************************"
echo "*Verify that Chrome is closed and not running!*"
echo "***********************************************"
echo
echo
echo "The files will be saved to: " $scriptDir/$USER-Chromedata-$dateTime/
echo
read -p "Press [Enter] to continue; (Ctrl+C to exit)... "}
#Creates the storage hierarchy in the active working directory
mkdir $scriptDir/$USER-Chromedata-$dateTime/
mkdir $scriptDir/$USER-Chromedata-$dateTime/Cache
# Copies the Chrome application folder to the destination path
# -a is archive mode (same as -rlptgoD)
# -v is verbose mode
# -P is to show the progress
# | tee is used to send the output to a log file and to the console
rsync -avP "$HOME/Library/Application Support/Google/Chrome" $scriptDir/$USER-Chromedata-$dateTime/ | tee $scriptDir/$USER-Chromedata-$dateTime/$USER-Chromedata-$dateTime.log
rsync -avP "$HOME/Library/Caches/Google" $scriptDir/$USER-Chromedata-$dateTime/Cache/ | tee $scriptDir/$USER-Chromedata-$dateTime/$USER-ChromeCache-$dateTime.log
#!/bin/bash
# Creates a unique variable containing the time and day the script was run.
# This is used in the creation of the file path
dateTime=$(date +"%m%d%y-%H%M%S")
#Creates a variable to store the location of the script to create the destination folder
scriptDir=$(dirname "$0")
#Displays warning and waits for user input
echo
echo "************************************************"
echo "*Verify that Firefox is closed and not running!*"
echo "************************************************"
echo
echo
echo "The files will be saved to: " $scriptDir/$USER-FFdata-$dateTime/
echo
read -p "Press [Enter] to continue; (Ctrl+C to exit)... "
#Creates the storage hierarchy in the active working directory
mkdir $scriptDir/$USER-FFdata-$dateTime/
mkdir $scriptDir/$USER-FFdata-$dateTime/Caches/
# Copies the Firefox data to the destination path
# -a is archive mode (same as -rlptgoD)
# -v is verbose mode
# -P is to show the progress
# | tee is used to send the output to a log file and to the console
rsync -avP "$HOME/Library/Application Support/Firefox" $scriptDir/$USER-FFdata-$dateTime/ | tee $scriptDir/$USER-FFdata-$dateTime/$USER-FFdata-$dateTime.log
rsync -avP "$HOME/Library/Caches/Firefox" $scriptDir/$USER-FFdata-$dateTime/Caches/ | tee $scriptDir/$USER-FFdata-$dateTime/$USER-FFcache-$dateTime.log
#!/bin/bash
#Creates a unique variable containg the time and date the script was ran.
#This is used in the creation of the file path
dateTime=$(date +"%m%d%y-%H%M%S")
#Creates a variable to store the location of the script to create the destination folder
scriptDir=$(dirname "$0")
#Displays warning and waits for user input
echo
echo "***********************************************"
echo "*Verify that Safari is closed and not running!*"
echo "***********************************************"
echo
echo
echo "The files will be saved to: " $scriptDir/$USER-SafariData-$dateTime/
echo
read -p "Press [Enter] to continue; (Ctrl+C to exit)..."
#Creates the storage hierarchy in the active working directory
mkdir $scriptDir/$USER-SafariData-$dateTime/
mkdir $scriptDir/$USER-SafariData-$dateTime/Cache/
#Copies the Safari data to the destination path
#-a is archive mode (same as -rlptgoD)
#-v is verbose mode
# -P is to show the progress
# | tee is used to send the output to a log file and to the console
rsync -avP "$HOME/Library/Safari" $scriptDir/$USER-SafariData-$dateTime/ | tee $scriptDir/$USER-SafariData-$dateTime/$USER-SafariData-$dateTime.log
rsync -avP "$HOME/Library/Caches/com.apple.Safari" $scriptDir/$USER-SafariData-$dateTime/Cache/ | tee $scriptDir/$USER-SafariData-$dateTime/$USER-SafariCache-$dateTime.log