summaryrefslogtreecommitdiff
path: root/removeaccount.sh
diff options
context:
space:
mode:
authorLuke <luke@lukesmith.xyz>2018-02-09 23:47:29 -0700
committerLuke <luke@lukesmith.xyz>2018-02-09 23:47:29 -0700
commit914a1bf4d895a986adaa240e857b95c7f49fed4c (patch)
tree0a600d747198fe6143b9986bb71969a0ea47b243 /removeaccount.sh
initial commit
Diffstat (limited to 'removeaccount.sh')
-rwxr-xr-xremoveaccount.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/removeaccount.sh b/removeaccount.sh
new file mode 100755
index 0000000..1d1cbcc
--- /dev/null
+++ b/removeaccount.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+muttdir="$HOME/Repos/email-mutt-offline/"
+
+# This script will remove an account from ~/.offlineimaprc and the
+# designated location in ~/.config/mutt/accounts.
+
+# Feed the script the title of the account.
+
+title=$1
+
+removeAccount() { sed -ie "
+ /Account $title]/,/Account/{//!d}
+ /Account $title]/d
+ s/ $title\(,\|$\)//g
+ s/=$title\(,\|$\)/=/g
+ s/,$//g
+ " ~/.offlineimaprc
+ rm "$muttdir"accounts/$title.muttrc
+ echo $title deleted. ;}
+removeAccount $title