Has Bourne and C Shell Syntax

zsh understands both major shell styles. Example: for (from sh) and foreach (from csh) list-iterating loops, case (from sh) and if (from csh) string matching tests:

  for file in `find . -name '*.ps*' -print`
  do
    case "$file" in
    *.ps) lpr "$file" ;;
    *.ps.gz) zcat "$file" | lpr ;;
    esac
  done

  foreach file (`find . -name '*.ps*' -print`)
    if ("$file" =~ *.ps) then
      lpr "$file"
    else if ("$file" =~ *.ps.gz) then
      zcat "$file" | lpr
    endif
  end
  

 

 

< previous  index  next >

Contact Jerry Peek