home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / util-linux < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.4 KB  |  77 lines

  1. # Completions for tools included in util-linux (not necessarily Linux specific)
  2.  
  3. # renice(8) completion
  4. #
  5. have renice &&
  6. _renice()
  7. {
  8.     local command cur curopt i
  9.  
  10.     COMPREPLY=()
  11.     _get_comp_words_by_ref cur
  12.     command=$1
  13.  
  14.     i=0
  15.     # walk back through command line and find last option
  16.     while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do
  17.         curopt=${COMP_WORDS[COMP_CWORD-$i]}
  18.         case "$curopt" in
  19.             -u)
  20.                 COMPREPLY=( $( compgen -u -- "$cur" ) )
  21.                 ;;
  22.             -g)
  23.                 _pgids
  24.                 ;;
  25.             -p|$command)
  26.                 _pids
  27.                 ;;
  28.         esac
  29.         i=$(( ++i ))
  30.     done
  31. } &&
  32. complete -F _renice renice
  33.  
  34. # kill(1) completion
  35. #
  36. have kill &&
  37. _kill()
  38. {
  39.     local cur
  40.  
  41.     COMPREPLY=()
  42.     _get_comp_words_by_ref cur
  43.  
  44.     if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
  45.         # return list of available signals
  46.         _signals
  47.     else
  48.         # return list of available PIDs
  49.         _pids
  50.     fi
  51. } &&
  52. complete -F _kill kill
  53.  
  54. # look(1) completion
  55. #
  56. have look &&
  57. _look()
  58. {
  59.     local cur
  60.  
  61.     COMPREPLY=()
  62.     _get_comp_words_by_ref cur
  63.  
  64.     if [ $COMP_CWORD = 1 ]; then
  65.         COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) )
  66.     fi
  67. } &&
  68. complete -F _look -o default look
  69.  
  70. # Local variables:
  71. # mode: shell-script
  72. # sh-basic-offset: 4
  73. # sh-indent-comment: t
  74. # indent-tabs-mode: nil
  75. # End:
  76. # ex: ts=4 sw=4 et filetype=sh
  77.