summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-09-02 23:52:14 +0200
committerGitHub <noreply@github.com>2016-09-02 23:52:14 +0200
commitd50bfcecbaae8740d3da1250dd4c0f2561392b18 (patch)
tree537c9ac30b77bb705a8dd13244b78d3f5db459a9 /mcom
parent8d3fa82d8246a08d2c7899963ad7cf61b7a4563c (diff)
parent81fbda6ff1a2bfe67ecef63c5ceb5990329767c1 (diff)
downloadmblaze-d50bfcecbaae8740d3da1250dd4c0f2561392b18.tar.gz
mblaze-d50bfcecbaae8740d3da1250dd4c0f2561392b18.tar.xz
mblaze-d50bfcecbaae8740d3da1250dd4c0f2561392b18.zip
Merge pull request #3 from escondida/profiles
Add $MBLAZE environment variable to set profile location
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom19
1 files changed, 13 insertions, 6 deletions
diff --git a/mcom b/mcom
index f720c2b..e7d8b40 100755
--- a/mcom
+++ b/mcom
@@ -18,7 +18,8 @@ msgdate() {
 	mdate
 }
 
-outbox=$(mhdr -h outbox ~/.mblaze/profile)
+MBLAZE=${MBLAZE:-$HOME/.mblaze}
+outbox=$(mhdr -h outbox "$MBLAZE/profile")
 if [ -z "$outbox" ]; then
 	i=0
 	while [ -f "snd.$i" ]; do
@@ -43,9 +44,9 @@ fi
 		echo "Cc: "
 		echo "Bcc: "
 		echo "Subject: "
-		from=$(mhdr -h local-mailbox ~/.mblaze/profile)
+		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
 		[ "$from" ] && echo "From: $from"
-		cat ~/.mblaze/headers 2>/dev/null
+		cat "$MBLAZE/headers" 2>/dev/null
 		msgid
 		msgdate
 		echo
@@ -59,7 +60,7 @@ fi
 		echo "Cc: $(mhdr -d -A -h to:cc: "$1" | commajoin)"
 		echo "Bcc: "
 		echo "Subject: Re: $(mscan -f '%S' "$1")"
-		cat ~/.mblaze/headers 2>/dev/null
+		cat "$MBLAZE/headers" 2>/dev/null
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then
 			echo -n "References:"
@@ -77,9 +78,15 @@ fi
 		echo
 	esac
 
-	if [ -f ~/.signature ]; then
+	if [ -f "$MBLAZE/signature" ]; then
+		SIGNATURE="$MBLAZE/signature"
+	elif [ -f ~/.signature ]; then
+		SIGNATURE="$HOME/.signature"
+	fi
+
+	if [ -n "$SIGNATURE" ]; then
 		printf '%s\n' '-- '
-		cat ~/.signature
+		cat "$SIGNATURE"
 	fi
 } >$draft