Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

42 Zeilen
1017 B

  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. echo $1 deleted. ;}
  17. #/tmp/numbered
  18. accounts=()
  19. while read n s ; do
  20. accounts+=($n "$s" off)
  21. done < /tmp/numbered
  22. choices=$(dialog --separate-output --checklist "Choose an email account to remove." 22 76 16 "${accounts[@]}" 2>&1 >/dev/tty)
  23. clear
  24. if [ -z "$choices" ];
  25. then
  26. echo no selection
  27. else
  28. todelet=$(IFS="|"; keys="${choices[*]}"; keys="${keys//|/\\|}"; grep -w "${keys}" /tmp/numbered | awk '{print $2}')
  29. for i in $todelet; do removeAccount $i; done
  30. fi