source/prog/lang-guile/guile-bash
Dmitry Bogatov 0653b0fa31 Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469'
git-subtree-dir: prog/lang-guile/guile-bash
git-subtree-mainline: 5ed4cf0ae9
git-subtree-split: 1eabc563ca
2023-07-23 16:37:06 -04:00
..
contrib Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
lisp Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
m4 Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
src Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
tests Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
.gitignore Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
AUTHORS Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
COPYING Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
ChangeLog Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
INSTALL Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
Makefile.am Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
NEWS Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
README Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
bootstrap Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
config.rpath Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
configure.ac Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
modules.af Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00
run-scm.in Add 'prog/lang-guile/guile-bash/' from commit '1eabc563ca5692b3e08d84f1f0e6fd2283284469' 2023-07-23 16:37:06 -04:00

README

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)))