scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

dmenu-mail-aliases (469B)


      1 #!/bin/sh
      2 
      3 # Select mail alias via dmenu
      4 # The email address must be the second word in a line of $aliasfile
      5 # Requires: dmenu (or similar)
      6 
      7 # Usage: dmenu-mail-aliases [-m menu]
      8 
      9 usage() {
     10 	echo "Usage: dmenu-mail-aliases [-m MENU]"
     11 }
     12 
     13 menu="dmenu -l 20"
     14 aliasfile="$HOME/.mblaze/aliases"
     15 
     16 while getopts "m:" opt; do
     17 	case "$opt" in
     18 		m)
     19 			menu="$OPTARG"
     20 			;;
     21 		*)
     22 			usage
     23 			exit 1
     24 			;;
     25 		esac
     26 done
     27 shift $((OPTIND - 1))
     28 
     29 $menu <"$aliasfile" | awk '{print $NF}'