mailselect (586B)
1 #!/bin/sh 2 3 user=$(grep '#user' < ${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/neomuttrc | awk '{print $2}' | dmenu -i) 4 5 [ "$user" = "" ] && printf "no profile selected" && exit 1 6 7 new=$( 8 echo "source $user #user" 9 awk -v "profile=$user" ' 10 $3 == "#user" && $1 == "source" && $2 != profile { 11 print "#" $0 12 } 13 14 $3 == "#user" && $1 == "#source" && $2 != profile 15 $3 == "#user" && $1 == "#source" && $2 == profile { 16 ; 17 } 18 $3 != "#user" 19 20 21 ' 22 ) < ${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/neomuttrc 23 24 echo "$new" > ${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/neomuttrc 25 echo "updated"