页面

2011-10-02

racket scripting demo

good toy!
#! /usr/bin/racket

#lang racket/base

"greeting to shell"
(displayln "hello, racket scripting")
(printf "given arguments: ~s\n"
	   (current-command-line-arguments))

(require racket/system)

;; grep a word in the racket manual: $ the_script racket scheme
(system (string-append "man " 
	   (vector-ref (current-command-line-arguments) 0) 
	   " | grep " 
	   (vector-ref (current-command-line-arguments) 1)))

"bye~~~"
refer to:
section 19.2 of `the racket guide': scripts.
section 14.4 of `the racket guide': processes.

没有评论: