Subject: Re: man : List of all commands in a section
From: charles Bobo <[email-masked]>
To: [email-masked]
Cc: Alex Vinokur <[email-masked]>
Date: Fri, 29 Dec 2006 21:43:16 -0500
List-Id: <cygwin.cygwin.com>

On Oct 1, 2002, at 12:37 AM, Alex Vinokur wrote:

> =============
> Windows 2000
> CYGWIN_NT-5.0
> =============
>
> Is it possible to get list of
> * all section
> * all commands in some section ?
>
>
>    ==================
>    Alex Vinokur
>      mailto:[email-masked]
>      http://up.to/alexvn
>    ==================
>
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>

Here is a shell script I wrote to list all commands in the PATH:
=========== snip ============
#!/bin/sh

# list all commands: list all executable commands in the current PATH.

myPATH="$(echo $PATH | sed -e 's/ /~~/g' -e 's/:/ /g')"
count=0; cmdlist="";

for dirname in $myPATH ;  do
   directory="$(echo $dirname | sed 's/~~/ /g')"
   if [ -d "$directory" ] ; then
     for command in $(ls "$directory") ; do
       if [ -x "$directory/$command" ] ; then
         count="$(( $count + 1 ))"
         cmdlist="$cmdlist $command"
       fi
     done
   fi
done

#echo "$count commands:"
for cmd in $cmdlist ; do
   echo $cmd
done
=========== snip ============

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/