|
|
|
|
|
by kbp
2990 days ago
|
|
I've never used it as a shell per se, but another little tweak I do sometimes for shell script type things in Lisp is install a read macro like (set-macro-character
#\$ #'(lambda (stream char)
(declare (ignore char))
`(uiop:getenv ,(symbol-name (read stream)))))
This lets you read environment variables like $home, and write to them like ordinary variables, eg (setf $message "hello"). It reads the variable name as a Lisp symbol, so by default it will be upcased; this happens to be convenient for environment variables, but as with any symbols in Lisp, you can escape lowercase characters using either \ before the character or |'s around the whole symbol, or you could change the readtable case, or just preserve case initially in the read macro. |
|