Andrew Gaydenko schrieb:
======= On Monday 31 March 2008, Etaoin Shrdlu wrote: =======On Monday 31 March 2008, 11:31, Andrew Gaydenko wrote:I agree, my English is ugly. I'll try to explain. Saying "viewer" I mean something like this:logviewer kdelibs will "produce" the same output as, say, less /usr/portage/kde-base/kdelibs/ChangeLog You see, it is impossible to remember all packages' dirs. Of course, I can use 'q' or 'eix' to find a dir and then type in a long 'less ...' command. But, well, why do all these 'eix' and 'q' exist? I think to save some users' time. Is my intention more clear now? :-)Neil will surely provide an adequate answer, however, if your needs aren't too sophisticated, you could put together something like $ cat logviewer.sh #!/bin/bash if [ -z "$1" ]; then echo "Must specify package name!" >&2 exit 1 fi p=`eix --only-names -e "$1"` if [ -z "$p" ]; then echo "$1: No matches found" >&2 exit 1 else howmany=`echo "$p" | wc -l` if [ "$howmany" -gt 1 ]; then echo "Many packages with the same name, refine search string:"&2 echo "$p" >&2exit 1 fi fi c="/usr/portage/${p}/ChangeLog" if [ -z "$EDITOR" ]; then EDITOR=`which vi` fi "$EDITOR" "$c" --------- You can also remove the "-e" from the eix line if you want approximate matching (that will require you to specify the category almost always though). Hope this helps.Thanks! I definitely must read a bash documentaton :-)
I think this will be your friend: http://tldp.org/LDP/abs/html/
signature.asc
Description: OpenPGP digital signature