delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/29/21:43:33

X-Spam-Check-By: sourceware.org
In-Reply-To: <002d01c26904$36f1ff10$176196d4@5at8s8cqeex4qhi>
References: <002d01c26904$36f1ff10$176196d4 AT 5at8s8cqeex4qhi>
Mime-Version: 1.0 (Apple Message framework v752.2)
Message-Id: <DD7490AC-2ADC-47EB-B363-1DBA5B088038@mac.com>
Cc: Alex Vinokur <alexvn AT come DOT to>
From: charles Bobo <charles DOT bobo AT mac DOT com>
Subject: Re: man : List of all commands in a section
Date: Fri, 29 Dec 2006 21:43:16 -0500
To: cygwin AT cygwin DOT com
X-Mailer: Apple Mail (2.752.2)
X-Brightmail-scanned: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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:alexvn AT go DOT to
>      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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019