[svlug] Questions about Redhat 5.2

Seth David Schoen schoen at uclink4.berkeley.edu
Sun Jan 24 20:38:09 PST 1999


Karsten M. Self writes:

> and just to totally confuse you, you can try something like the
> following, which also provides you an introduction to shell scripting:
> 
> The following creates a file 'describe.sed', which is a "sed" secript. 
> Cut and paste to your command line to create, leaving off the initial
> '#' (stands for the command prompt).
> 
> # cat <<EOF > describe.sed 
> #!/bin/sed -nf 
> /^.*N.NA.AM.ME.E/{
>     n
>     p
>     q
> }
> EOF
> 
> 
> Enter the following two commands:
> 
> # chmod +x describe.sed
> # for file in `ls /bin`; do man $file | ./describe.sed; done 2>/dev/null

How about

for file in `ls /bin`; do LESS=-E whatis $file; done

instead?  (You want "LESS=-E" so that you don't get prompted to hit keys
after the output for every single command.)

Instead of your output

>        arch - print machine architecture
>        ash - a shell
>        gawk - pattern scanning and processing language
>        basename - strip directory and suffix from filenames
>        bash - GNU Bourne-Again SHell
>        ash - a shell
>        cat - concatenate files and print on the standard output
>        chgrp - change the group ownership of files
>        chmod - change the access permissions of files
>        chown - change the user and group ownership of files
>        cp - copy files
>        cpio - copy files to and from archives

my version gets

arch (1)             - print machine architecture
ash (1)              - a shell
ash.static: nothing appropriate
awk: nothing appropriate
basename (1)         - strip directory and suffix from filenames
basename (3)         - extract just the filename from a path
bash (1)             - GNU Bourne-Again SHell
bash (1)             - GNU Bourne-Again SHell
bru (1)              - backup and restore utility
bsh: nothing appropriate
cat (1)              - concatenate files and print on the standard output
chgrp (1)            - change the group ownership of files
chmod (1)            - change the access permissions of files
chmod, fchmod (2)    - change permissions of a file
chown (1)            - change the user and group ownership of files
chown, fchown (2)    - change ownership of a file
cp (1)               - copy files
cpio (1)             - copy files to and from archives

which is different in three ways: commands have their manual section numbers
shown, manual page entries for things other than commands that have the same
name as commands are shown, and the behavior when describing a command
that is actually a link to another command is different (so whatis bsh shows
"bsh: nothing appropriate", while man bsh | describe.sh shows "ash - a
shell", and whatis awk shows "awk: nothing appropriate", where
man awk | describe.sh shows "gawk - pattern scanning and processing
language").

One of these differences could be remedied by adding

| egrep '[168]'

at the end.  The problem about symlinks is a bit harder to get around.

-- 
              Seth David Schoen / schoen at uclink4.berkeley.edu
He said, "This is what the king who will reign over you will do."  And they
said, "Nay, but we will have a king over us, that we also may be like all the
nations." (1 Sam 8)  http://ishmael.geecs.org/~sigma/   http://www.loyalty.org/

--
echo "unsubscribe svlug" | mail majordomo at svlug.org
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to unsubscribe
see http://www.svlug.org/mdstuff/lists.shtml for posting guidelines.



More information about the svlug mailing list