Skip to content

Instantly share code, notes, and snippets.

@geolimber
Created August 15, 2020 04:20
Show Gist options
  • Save geolimber/cd32bc43bd04ce35cb754cf8e37bf765 to your computer and use it in GitHub Desktop.
Save geolimber/cd32bc43bd04ce35cb754cf8e37bf765 to your computer and use it in GitHub Desktop.
Script to retrieve values for your bank transfer coordinates, stored in encrypted gpg file. Put script in your PATH and don't forget chmod +x. Obviously you need to prepare your transfer coordinates file. This will ask your gpg passcode on runtime.
#!/bin/bash
#-----------------------------#
# Example content of .gpg file:
# declare -a a=(01 02 03 04 05)
# declare -a b=(01 02 03 04 05)
# declare -a c=(01 02 03 04 05)
# declare -a d=(01 02 03 04 05)
# ....
# Usage: santa a1 e4 j2
#-----------------------------#
. <(gpg -qd ~/path/to/your/file.gpg)
# Parsing input values
coordinate1=$1
coordinate2=$2
coordinate3=$3
letter1=${coordinate1:0:1}
letter2=${coordinate2:0:1}
letter3=${coordinate3:0:1}
number1=$((${coordinate1:1:1}-1))
number2=$((${coordinate2:1:1}-1))
number3=$((${coordinate3:1:1}-1))
pattern1=$letter1[$number1]
pattern2=$letter2[$number2]
pattern3=$letter3[$number3]
# Making shure no one could scroll your term to see input and corresponding output
clear
echo ${!pattern1} ${!pattern2} ${!pattern3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment