Bash Scripting For Buffoons - Bills Script

Ceri Shaw
02/28/16 04:20:40AM
@ceri-shaw


Bills Script



⇦ Back to 'Bash Scripting For Buffoons'

If you are in the habit of paying bills online you will no doubt be familiar with the exhortation to print a copy of your payment confirmation for your records. Why? You have a computer. Why would you not screenshot your confirmation and store it on your hard drive rather than piling up bits of paper which you will inevitably lose? Of course any financial records kept on your hard drive need to be stored securely. The following script allows you to do precisely that.  It encrypts and datestamps any .png in the folder in which it resides and moves it to the 'bills' folder.

You will need to create a bills folder in 'Documents' and install the ' ccrypt ' program before it will work. You will also need to develop the habit of storing paymentconfirmations as screenshots. Unfortunately the script is not selective and it will consign any and all .png's to the 'bills' folder  whether you want them there or not. The menu offers 'Open', "Close', "Append' and "List' options all of which are self-explanatory. This script has a number of amusing quirks and deficiencies as a consequence of under-development.

I suppose it could be useful, it just needs  a lot more work.


#!/bin/bash
space () {
 echo " "
 echo "Done"
 echo " "
 }
open () {
ccrypt -d ~/Documents/bills/*.cpt ;
nautilus ~/Documents/bills ;
space ;
  }
close () {
ccrypt -e ~/Documents/bills/*.png ;
space ;
 }
openadd () {
for png in *.png; do mv {,"`date`"}$png; done
mv *.png ~/Documents/bills ;
ccrypt -e ~/Documents/bills/*.png ;
space ;
 }
list () {
ls /home/userone/Documents/bills
space ;
}
 menu () {
 echo  "======================================="
 echo  "Please select from the following menu:-"
 echo  " "
 echo  "1  Open bills folder."
 echo  "2  Close bills folder."
 echo  "3  Append to bills folder."
 echo  "4  List bills folder."
 echo  " "
 read  NAME
 case  "$NAME" in
 1)
open ;;
 2)
close ;;
 3)
openadd ;;
 4)
list ;;
 esac
 }
menu

exit 0