Thought this would be useful for bash alias lovers with lots of shortcuts in their ~/.bashrc or ~/.bash_aliases (path defined in the $aliases variable below).
Cheers! --Samee -#!/bin/sh +#!/bin/bash cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} if [ -d "$cachedir" ]; then cache=$cachedir/dmenu_run else cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~ fi -( +cmd=`( IFS=: - if stest -dqr -n "$cache" $PATH; then - stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@" + aliases=~/.bashrc + if stest -dqr -n "$cache" $PATH || stest -fqr -n "$cache" "$aliases"; then + ( + stest -flx $PATH + source $aliases + alias | sed 's/alias \([[:alnum:]]\+\)=.*/\1/' + ) | sort -u | tee "$cache" | dmenu "$@" else dmenu "$@" < "$cache" fi -) | ${SHELL:-"/bin/sh"} & +)` +# Perform alias expansion on $cmd +echo -e "source ~/.bashrc \n $cmd" | bash -O expand_aliases &