Prev Up Next

The system procedure executes its argument string as an operating-system command. It returns true if the command executed successfully with an exit status 0, and false if it failed to execute or exited with a non-zero status. Any output generated by the command goes to standard output.

(system "ls") 
;lists current directory

(define fname "spot")

(system (string-append "test -f " fname)) 
;tests if file `spot' exists

(system (string-append "rm -f " fname)) 
;removes `spot'

The last two forms are equivalent to

(file-exists? fname)

(delete-file fname)

Prev Up Next

Log in or register to write something here or to contact authors.