scripts/mprofile

16 lines
509 B
Plaintext
Raw Normal View History

2023-12-10 18:54:14 +01:00
#!/bin/sh
profiles=$(find "$HOME"/.config/mblaze -type f -exec basename "{}" \;)
currentMaildir=$(grep "^Maildir:" "$HOME"/.mblaze/profile | cut -d: -f 2 | sed 's/ //g')
[ -z "$1" ] && basename "$(grep -w "$currentMaildir" -l -R "$HOME"/.config/mblaze)" && exit 0
[ "$1" = "-l" ] && printf '%s\n' "$profiles" && exit 0
profile="$1"
if printf '%s\n' "$profiles" | grep -qw "$profile"; then
cp "$HOME"/.config/mblaze/"$profile" "$HOME"/.mblaze/profile
else
printf '%s\n' "This profile doesn't exist"
fi