Skip to content

Instantly share code, notes, and snippets.

@matthiasbeyer
Created February 8, 2015 17:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthiasbeyer/b15f7d0ca88754c65fd4 to your computer and use it in GitHub Desktop.
Save matthiasbeyer/b15f7d0ca88754c65fd4 to your computer and use it in GitHub Desktop.
dmenu-like bash script
list=""
for p in $(echo $PATH | sed 's,:, ,g')
do
list="$list $(find $p -type f -o -type l -executable 2>/dev/null)"
done
currlist=$list
x=".*"
while read -n 1 y;
do
if [[ -z "$(echo "$y" | sed 's: \n::')" ]]
then
break
fi
x="$x$y"
if (( ${#x} > 3 ))
then
currlist=$(echo $currlist | xargs -n1 | grep -E "$x" | xargs)
for l in $currlist
do
echo $l
done
fi
printf "\n%s\n" $x
done
echo $currlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment