Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check and download (update) last electrum version, backup wallet. Linux Only
# Exit if any errors
set -e
# Working directory
cd "$HOME"
# Check curl command
if ! [ -x "$(command -v curl)" ]; then
echo "could not find curl"
exit 1
# Check last source version from github
echo "Fetch last version from github ..."
lastversion=$(curl -s | head -1 | awk {'print substr($3, 2, length($3)-2)'})
# Check if installed version the same as fetched
if [ -x "$(command -v electrum)" ]; then
installed_version=$(echo $($(which electrum) version))
if [ "$installed_version" == "$lastversion" ]; then
echo -e "Installed version $installed_version equal last version $lastversion \n"
exit 1
if curl --output /dev/null --silent --head --fail "$lastversion_source"; then
echo "There is $lastversion version"
echo "Download electrum $lastversion wallet source ..."
echo "Could not find version: $lastversion on the"
exit 1
# Download last version
echo -n "Install download electrum $lastversion (y/n)?"
read download_electrum
if echo "$download_electrum" | grep -iq "^y" ;then
dest="$HOME/electrum_$lastversion_$(date '+%Y-%m-%d_%H:%M:%S')"
mkdir -p $dest
curl -s $lastversion_source | tar xz --directory $dest
echo -n "Backup current wallet (y/n)?"
read backup_electrum
if echo "$backup_electrum" | grep -iq "^y" ;then
echo "Backup old electrum version ..."
cp -R "$HOME/.electrum" "$HOME/electrum_wallet_backup"
mv electrum_wallet_backup "$dest"
rm -rf "$HOME/electrum_wallet_backup"
echo "Electrum wallet has been backuped to the '$dest'"
echo "The new version '$lastversion' downloaded to the folder '$dest'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.