Sorry for the duplicate email: apparently gmail formatted my previous email as HTML and it didn't actually go through to dev@suckless
--- Original email --- Hello Robert, I'm glad you found the patch helpful. About the way it is being displayed on your dmenu, I think sed might be configured differently on our machines. It does actually just display "my-alias" when I use it. This line is the likely culprit: > alias | sed 's/alias \([[:alnum:]]\+\)=.*/\1/' Run this as a standalone command on your machine and see what happens. Ideally, it should only display a list of alias names, not their expansions or any '=' sign. But if your output is the same as just running "alias" all by itself, the sed is simply not working. My best guess: you have sed configured to use extended syntax. In that case, something like this should solve your problem: > alias | sed -r 's/alias ([[:alnum:]]+)=.*/\1/' The -r is not really needed if your system is already configured to add it by default, but this makes sure it works regardless of what the default is on your system. Let me know if this helps (or doesn't help) --Samee On Thu, Dec 26, 2013 at 1:41 AM, <orsch...@gmail.com> wrote: > Thanks for your modification Samee. This is incredibly useful. I adapted > your script and changed .bashrc to .zsh_aliases since all my aliases reside > in there. > > When running dmenu my aliases are finally recognised! The only drawback is > that in the menu they are shown as alias my-alias='command substitute'. > > However, I would like to just display my-alias. Is this possible? > > Cheers, > > Robert > > > On Monday, 10 June 2013 05:04:58 UTC+2, Samee Zahur wrote: >> >> 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 & >> >