On Sun, Jul 24, 2005 at 12:36:25AM +1200, Wesley Parish wrote:
> // A small comparison of scripting languages: :-)
> 
> The following code snippets aim to provide an idea of how scsh compares
> with other common scripting languages. They all print a list of all the
> executables available in the current PATH to the standard output

pike version:

#!/usr/bin/pike

void main()
{
  foreach(getenv()->PATH/":";; string dir)
  {
    foreach(get_dir(dir);; string file)
    {
      Stdio.Stat stat = file_stat(dir+"/"+file);
      if(stat->isreg &&  stat->mode & 0b1001001)
        write(file+"\n");
    }
  }
}

greetings, martin.
-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
offering: programming, training and administration   -  anywhere in the world
--
pike programmer   travelling and working in europe             open-steam.org
unix system-      bahai.or.at                        iaeste.(tuwien.ac|or).at
administrator     (caudium|gotpike).org                          is.schon.org
Martin Bähr       http://www.iaeste.or.at/~mbaehr/

Reply via email to