Results 1 to 5 of 5

Thread: How to fix the "whereis" command

  1. #1
    Join Date
    Jul 2008
    Location
    Tr4nc3LanD
    Posts
    24

    Question How to fix the "whereis" command

    Before today when I were going to type in console the command whereis (and for example) fire then pressing [TAB] will complete the word to firefox, if I were going to type ama [TAB] that will be completed to amarok or I was presented with all the options beginning with "ama"

    Now when I press tab the word after the command whereis is not completed anymore.

    Do you know what can I do to fix the feature/command ?

    The only change I have performed lattely is that I resized my home partition (I increased its size) and I also installed firefox 3.0.1

    What could have caused this ? and how can I fix this ?

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How to fix the "whereis" command

    It's simply that whereis was not programmed as one of the commands that take command completion. These are specified to bash when it starts up, in

    Code:
    /etc/profile.d/complete.bash
    If you do:

    Code:
    complete | grep which
    you should get:

    Code:
    complete -o default -c which
    Now whereis behaves like which in taking a command also. Search in /etc/profile.d/bash.completion and find the instance of which, which is:

    Code:
    complete -A command ${_def}             command which nohup exec nice eval
    Add whereis to that list. Or you can test it from the current shell by:

    Code:
    complete -o default -c whereis
    after which you can do:

    Code:
    whereis fire<tab>
    BTW I knew about programmable completion but your post spurred me to learn something new today.

    PS: Make a note of this local change, so that you put it back after a version upgrade.

    PPS: Here's a nice tute I found:

    CLI magic: programable bash completion Linux by Examples

  3. #3
    Join Date
    Jul 2008
    Location
    Tr4nc3LanD
    Posts
    24

    Default Re: How to fix the "whereis" command

    Quote Originally Posted by ken_yap View Post
    Search in /etc/profile.d/bash.completion and find the instance of which, which is:

    Code:
    complete -A command ${_def}             command which nohup exec nice eval
    Add whereis to that list. Or you can test it from the current shell by:

    Code:
    complete -o default -c whereis
    The problem is I dont have that file callled "bash.completion"

    Should I create it and add the line you suggested ?

    This is all what I have inside there:

    Code:
    Dixie7:/etc/profile.d # ll
    total 228
    -rw-r--r-- 1 root root  1547 Aug 18  2005 alias.ash
    -rw-r--r-- 1 root root  1438 Aug 30  2005 alljava.csh
    -rw-r--r-- 1 root root  1682 Jul 13  2005 alljava.sh
    -rw-r--r-- 1 root root 22772 Dec 21  2007 bindkey.tcsh
    -rw-r--r-- 1 root root  8584 Feb 26  2007 complete.bash
    -rw-r--r-- 1 root root 39715 Dec 21  2007 complete.tcsh
    -rw-r--r-- 1 root root   574 Jun  4  2007 csh.ssh
    -rw-r--r-- 1 root root  1169 Sep 17  2004 csh.utf8
    -rw-r--r-- 1 root root    51 Sep 21  2007 cvs.csh
    -rw-r--r-- 1 root root    50 Sep 21  2007 cvs.sh
    -rw-r--r-- 1 root root  1037 Jan 29  2007 desktop-data.csh
    -rw-r--r-- 1 root root   706 Jan 29  2007 desktop-data.sh
    -rwxr-xr-x 1 root root   180 Sep 21  2007 groff.csh
    -rwxr-xr-x 1 root root   179 Sep 21  2007 groff.sh
    -rw-r--r-- 1 root root   352 May 31 15:33 gtk2.csh
    -rw-r--r-- 1 root root   360 May 31 15:33 gtk2.sh
    -rw-r--r-- 1 root root    91 Mar  7 08:55 krb5.csh
    -rw-r--r-- 1 root root    91 Mar  7 08:55 krb5.sh
    -rw-r--r-- 1 root root  1731 Feb  1  2007 lang.csh
    -rw-r--r-- 1 root root  1556 Aug  2  2005 lang.sh
    -rw-r--r-- 1 root root   152 Sep 21  2007 opensp.csh
    -rw-r--r-- 1 root root   117 Sep 21  2007 opensp.sh
    -rw-r--r-- 1 root root  3010 Jan 29  2007 profile.csh
    -rw-r--r-- 1 root root  2713 Jan 29  2007 profile.sh
    -rw-r--r-- 1 root root    91 Jan 10  2008 python.csh
    -rw-r--r-- 1 root root    91 Jan 10  2008 python.sh
    -rw-r--r-- 1 root root    63 May 19  2006 qt3.csh
    -rw-r--r-- 1 root root   117 May 19  2006 qt3.sh
    -rw-r--r-- 1 root root   632 Jun  4  2007 sh.ssh
    -rw-r--r-- 1 root root   911 Apr  8  2004 sh.utf8
    -rw-r--r-- 1 root root   144 Sep 21  2007 via.csh
    -rw-r--r-- 1 root root   142 Sep 21  2007 via.sh
    -rw-r--r-- 1 root root   864 Sep 11  2007 xdg-environment.csh
    -rw-r--r-- 1 root root   614 Sep 11  2007 xdg-environment.sh
    -rw-r--r-- 1 root root 12726 Oct  4  2006 zzz-glib2.csh
    -rw-r--r-- 1 root root 11799 Oct  4  2006 zzz-glib2.sh

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How to fix the "whereis" command

    It's complete.bash, the first instance I mentioned it I got the name correct, but I got it wrong on the second instance.

  5. #5
    Join Date
    Jul 2008
    Location
    Tr4nc3LanD
    Posts
    24

    Default Re: How to fix the "whereis" command

    Forget it... I found it!

    The correct filename is:

    /etc/profile.d/complete.bash
    not:

    /etc/profile.d/bash.completion
    PS: why in this forum the edit button has been removed ???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •