You are not logged in.

#1 2014-10-21 13:00:14

agent0
Member
From: Russia
Registered: 2014-05-04
Posts: 74
Website

[SOLVED] Pkgfile works only if I source file in shell's run command

Hello. I have created discussion here: https://wiki.archlinux.org/index.php/Talk:Pkgfile, where I was told to open forum thread.
At the Command not found section it is explained that it will automatically search the official repositories, when entering an unrecognized command
But for me, it only works if I source file, as it is explained further:
To enable it in all children shells, you need to source the hook from one of your shell initialization files.
    Example for Bash: ~/.bashrc
source /usr/share/doc/pkgfile/command-not-found.bash
I think we shold make it workable as it is explained in wiki or edit wiki as it works.

By the way, why there was removed useful information about command-not-found aur package? See https://wiki.archlinux.org/index.php?ti … did=317469 I think we should explain in wiki about this package too.

Last edited by agent0 (2014-10-25 11:42:54)

Offline

#2 2014-10-21 16:56:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

The edit summary explains why was it removed: https://wiki.archlinux.org/index.php?ti … did=317469

Falconindy wrote:

remove section wholly unrelated to pkgfile


I don't understand what is the problem.
I installed pkgfile, run

$ . /usr/share/doc/pkgfile/command-not-found.bash
$ abiword
abiword may be found in the following packages:
  extra/abiword 3.0.0-3 /usr/bin/abiword

Works as explained in the wiki.
If you add this line to ~/.bashrc and reboot or spawn a new shell it should just work.

Offline

#3 2014-10-21 17:37:46

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2014-10-25 10:36:13

agent0
Member
From: Russia
Registered: 2014-05-04
Posts: 74
Website

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

Sorry for slow answer.
I think that we should explain about alternative hook, because Bash article has that section as related and there were not any information about it.
If you think that it is wholly unrelated to pkgfile article, than maybe we should rename article to "searching files from packages"?

Ok, maybe I do not understand what does "children shell" means? When I open Konsole, I see first shell, and if I run sh command, then I am in children shell, right? In article there is not any information that i need to run $ . /usr/share/doc/pkgfile/command-not-found.bash. I have just installed pkgfile and expected that it will give command not found suggestions in first shell. But it do not do so. In first shell it works only if I sourced /usr/share/doc/pkgfile/command-not-found.bash in my .bashrc.

Offline

#5 2014-10-25 11:14:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

If you change your ~/.bashrc, you have to source it to make the changes visible in the current shell:

$ type bbl
bbl is aliased to `vim ~/.bashrc; . ~/.bashrc'

I use this alias for editing my ~/.bashrc. You can also open a new shell or log out and log back in to your system to have it work automatically.
Instead of running 'sh', run 'bash'  and see if it works.

I moved that info to the bash article https://wiki.archlinux.org/index.php/Ba … _.28AUR.29 and updated the link: https://wiki.archlinux.org/index.php?ti … did=337912

Offline

#6 2014-10-25 11:28:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

agent0 wrote:

At the Command not found section it is explained that it will automatically search the official repositories, when entering an unrecognized command.  But for me, it only works if I source file, as it is explained further

Am I missing something here?  The wiki says that pkgfile includes that hook, and immediately afterwords says how to enable it.  You are claiming it only works for you when you enable it.  Good.  This is the expected behavior, that's why the instructions on how to enable that feature are right there in the wiki.  What is the issue here?

agent0 wrote:

In article there is not any information that i need to run $ . /usr/share/doc/pkgfile/command-not-found.bash.

Yes, there is.  It says to source that file from your shellrc file.  It even gives explcit examples on how to do that for bash and zsh.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2014-10-25 11:34:27

agent0
Member
From: Russia
Registered: 2014-05-04
Posts: 74
Website

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

Sorry, I am rather new here. As I said above, I expected, that hook will work immediately after installing pkgfile. I did not know, that I need to do some "enabling" to make hook work.
I think we can delete this thread.

Offline

#8 2014-10-25 11:39:35

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Pkgfile works only if I source file in shell's run command

The packages don't alter your ~/.bashrc, if any modification is needed, you are told to do it yourself.
You have to read the wiki and do what it tells you to do.

No need to remove this thread, just remember to mark the thread as solved https://bbs.archlinux.org/viewtopic.php?id=130309

Offline

Board footer

Powered by FluxBB