in reply to find a forgotten shell command

you could write it completely in perl. Perl provide a powerfull grep to catch over list and many file access method thru File::* or simply glob() like
perl -le '$cmd="ls";foreach (split(/:/,$ENV{"PATH"})){print grep(/$cmd +/, glob("$_/*"))} '
You could get inspired by the already made (in perl) unix command from PPT project to produce more granulated output.
--
dominix

Replies are listed 'Best First'.
Re: Re: find a forgotten shell command
by Tommy (Chaplain) on Jan 07, 2004 at 03:13 UTC

    Yep you are right. I didn't think of using glob, but I do know that Perl has a CORE::grep(). Nice job.

    But to which "already made (in perl) unix command from PPT" do you refer?

    --
    Tommy Butler, a.k.a. TOMMY
    
      in that case ls and grep (the only non perl things of the original script)
      --
      dominix

        Oh yes, I see. Thanks!

        --
        Tommy Butler, a.k.a. TOMMY