[Home] Zsh logo

match-services

Zsh Wizard

Download match-services Return to Examples
  1. #!/usr/local/bin/zsh
  2. # match-services - match lines in /etc/services
  3. # Just use simple grep and sed stuff to pull out the lines that
  4. # match the current word.
  5. reply=(`grep -v "^#" /etc/services | \
  6. grep "^$1[a-zA-Z0-9_-]*$2[ ]*.*tcp" | \
  7. sed 's/^\([a-zA-Z0-9_-]*\).*$/\1/'`)