~kaction/guile-bash

No description
1eabc563 — Dmitry Bogatov 6 years ago
Enable using of #[expr] syntax in conditionals
eba5f75f — Dmitry Bogatov 6 years ago
Emulate errexit option
3ca7e182 — Dmitry Bogatov 6 years ago
new script: run guile-bash scripts

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~kaction/guile-bash
read/write
git@git.sr.ht:~kaction/guile-bash

You can also use your local clone with git send-email.

guile-bash
==========

Guile-bash project provides shared library and set of Guile modules,
allowing you to extend Bash with lisp. You have means to access everything
in Bash process and the following aspects are given interface in scheme-spirit
without need to know anything about Bash internals:

- aliases
- setting and getting Bash variables
- creating dynamic variables
- creating bash function with Scheme implementation
- reader macro for output capturing
- reader macro for evaluating raw bash commands

This is fragment of my bash configuration:

(for-index [ix <- (1 .. 9)]
  (add-alias (~ "aw~d" ix) (~ "awk '{ print $~d }' " ix)))

(with-everything-catched
  (for-list (bin = emacs tmux fbterm env dtach)
    (unless (availiable? bin)
      (error 'required-program-is-not-availiable bin)))
  (when (and with-X? (not with-tmux?))
    #$ [exec tmux -2])
  (dtach-start-emacs)
  (when (equal? "/dev/tty1" #$(tty))
    #$[exec /usr/bin/fbterm -- /usr/bin/env TERM=fbterm tmux new])
  (when with-tmux?
    #$[source ~/.dircolors.sh]))

(let ((availiable-locales (string-split #$(locale -a) #\newline)))
  (let/ec escape
    (for-list (lang = eo eo_XX ru_RU en_US C)
      (for-list (enc = UTF-8 utf8)
	(define locale (~ "~a.~a" lang enc))
	(when (member locale availiable-locales)
	  #$[export LC_ALL]
	  (escape (set! #$LC_ALL locale)))))))

(for-each append-to-path
	  (list (~ "~a/scripts" +rc-root+)
		#$(echo ~/.cabal/bin)
	        #$(echo ~/.local/bin)))