Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

40 lignes
1.0 KiB

  1. #!/bin/sh
  2. muttdir="$HOME/.config/mutt/"
  3. # This script will remove an account from ~/.offlineimaprc and the
  4. # designated location in ~/.config/mutt/accounts.
  5. # Feed the script the title of the account.
  6. cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;' | nl --number-format=ln > /tmp/numbered
  7. removeAccount() { sed -ie "
  8. /Account $1]/,/Account/{//!d}
  9. /Account $1]/d
  10. s/ $1\(,\|$\)//g
  11. s/=$1\(,\|$\)/=/g
  12. s/,$//g
  13. " ~/.offlineimaprc
  14. rm "$muttdir"accounts/$1.muttrc
  15. rm "$muttdir"credentials/$1.gpg
  16. rm -rf "$muttdir"accounts/$1
  17. echo $1 deleted. ;}
  18. #/tmp/numbered
  19. accounts=()
  20. while read n s ; do
  21. accounts+=($n "$s" off)
  22. done < /tmp/numbered
  23. choices=$(dialog --separate-output --checklist "Choose an email account to remove." 22 76 16 "${accounts[@]}" 2>&1 >/dev/tty)
  24. clear
  25. if [ -z "$choices" ];
  26. then
  27. clear
  28. else
  29. todelet=$(IFS="|"; keys="${choices[*]}"; keys="${keys//|/\\|}"; grep -w "${keys}" /tmp/numbered | awk '{print $2}')
  30. for i in $todelet; do removeAccount $i; done
  31. fi