Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

dmenu_alias 1020B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. cache=~/.cache/dmenu_run
  3. freq=~/.dmenu_history
  4. aliases=~/.bash_aliases
  5. source $aliases
  6. case "$1" in
  7. remove)
  8. # To remove a file from history:
  9. # $ dmenu_recent_aliases remove <name>
  10. grep -v "$2" $freq > temp && mv temp $freq
  11. ;;
  12. *)
  13. (compgen -a; compgen -c | grep -vxF "$(compgen -a)") | sort | tail -n +10 > $cache
  14. sorted=$(sort $freq | uniq -c | sort -hr | colrm 1 8)
  15. cmd=`(echo "$sorted"; cat $cache | grep -vxF "$sorted") | dmenu "$@"`
  16. if ! [ "$cmd" == "" ] && ! [ "$(grep ${cmd/;/} $cache)" == "" ]; then
  17. echo ${cmd/;/} >> $freq
  18. cmdexec=$(alias | grep "${cmd/;/}=" | cut -f2 -d "'" | tr -d "'")
  19. if [ -z "$cmdexec" ]; then
  20. cmdexec=${cmd/;/}
  21. fi
  22. case $cmd in
  23. *\;) cmdexec="urxvt -e $cmdexec" ;;
  24. esac
  25. # Ugly workaround to run functions...
  26. echo "$cmdexec" | compgen -F "$cmdexec" | bash
  27. # ...and aliases
  28. echo "$cmdexec" | bash
  29. fi
  30. ;;
  31. esac