unnecessary sed 1q removed

This commit is contained in:
Luke Smith 2019-04-16 11:08:43 -04:00
parent d48f2818a9
commit b3974d3191
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252

25
mw
View File

@ -237,22 +237,22 @@ finalize() { \
printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n"
oneline="$(sed -e "s/^\|$/\"/g" "$tmpdir/title_boxes" | tr "\n" " ")"
oneline="=$title $delim $oneline"
spoolfile=$(grep -i "$tmpdir/title_boxes" -e inbox | sed -e 's/=/+/g' | sed 1q)
record=$(grep -i "$tmpdir/title_boxes" -e sent | sed -e 's/=/+/g' | sed 1q)
postponed=$(grep -i "$tmpdir/title_boxes" -e draft | sed -e 's/=/+/g' | sed 1q)
trash=$(grep -i "$tmpdir/title_boxes" -e trash | sed -e 's/=/+/g' | sed 1q)
spoolfile=$(grep -i -m 1 "$tmpdir/title_boxes" -e inbox | sed -e 's/=/+/g')
record=$(grep -i -m 1 "$tmpdir/title_boxes" -e sent | sed -e 's/=/+/g')
postponed=$(grep -i -m 1 "$tmpdir/title_boxes" -e draft | sed -e 's/=/+/g')
trash=$(grep -i -m 1 "$tmpdir/title_boxes" -e trash | sed -e 's/=/+/g')
sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$muttdir/accounts/$title.muttrc"
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$muttdir/accounts/$title.muttrc"
echo mailboxes "$oneline" >> "$muttdir/accounts/$title.muttrc"
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n"
sed -i "/# autogenerated/d" "$muttdir/accounts/$title.muttrc"
grep -i "$tmpdir/title_boxes" -e inbox | sed 1q | formatShortcut i inbox "$title"
grep -i "$tmpdir/title_boxes" -e sent | sed 1q | formatShortcut s sent "$title"
grep -i "$tmpdir/title_boxes" -e draft | sed 1q | formatShortcut d drafts "$title"
grep -i "$tmpdir/title_boxes" -e trash | sed 1q | formatShortcut t trash "$title"
grep -i "$tmpdir/title_boxes" -e spam | sed 1q | formatShortcut S spam "$title"
grep -i "$tmpdir/title_boxes" -e junk | sed 1q | formatShortcut j junk "$title"
grep -i "$tmpdir/title_boxes" -e archive | sed 1q | formatShortcut a archive "$title"
grep -i -m 1 inbox "$tmpdir/title_boxes" | formatShortcut i inbox "$title"
grep -i -m 1 sent "$tmpdir/title_boxes" | formatShortcut s sent "$title"
grep -i -m 1 draft "$tmpdir/title_boxes" | formatShortcut d drafts "$title"
grep -i -m 1 trash "$tmpdir/title_boxes" | formatShortcut t trash "$title"
grep -i -m 1 spam "$tmpdir/title_boxes" | formatShortcut S spam "$title"
grep -i -m 1 junk "$tmpdir/title_boxes" | formatShortcut j junk "$title"
grep -i -m 1 archive "$tmpdir/title_boxes" | formatShortcut a archive "$title"
printf "All done.\\n"
}
@ -261,8 +261,7 @@ confirm() { printf "Are you \033[31;1mreally\033[0m sure you want to %s?\\n\t" "
return 0 ;}
pick() { \
numbered="$(ls $accdir/*muttrc | sed "s/.*\///;s/\..*//" | nl)"
pick() { numbered="$(ls $accdir/*muttrc | sed "s/.*\///;s/\..*//" | nl)"
[ "$(echo "$numbered" | wc -w)" = 0 ] && printf "No accounts to choose from.\\n" && return 1
printf "Select an accounts to %s:\\n" "$1"
echo "$numbered"