File: test5.esh

package info (click to toggle)
esh 0.8-7
  • links: PTS
  • area: main
  • in suites: sarge, woody
  • size: 508 kB
  • ctags: 542
  • sloc: ansic: 3,608; lisp: 166; makefile: 72
file content (18 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#
# Regex globber. This script accepts a regular expresion and finds all
# filenames in the current directory that match it. The given command is then
# run with the matching filenames as arguments.
#

(define converter
  ~(run-simple (l-stack)))

(if ~(typecheck "ss" (stack))
    ~(print "Usage: (convert <regexp> <command>)" (nl))
    ~(converter (rot) (split 
                       (gobble (standard) 
			       ~(/bin/ls -1) 
			       (list grep (rot))))))