The original, deprecated way to use ebash was to simply source it at the top of your shell script. Suppose you had ebash
installed in /opt/ebash
, then you would do the following:
source "/opt/ebash/share/ebash.sh"
The newer way to use ebash is to simply invoke it with the --source
option and invoke that output using what is called
the eval command invocation string idiom: Assuming that ebash
is in your ${PATH}
, you can simply do the following
at the top of your shell scripts:
#!/bin/bash
$(ebash --source)
If ebash
is NOT in your ${PATH}
then you can simply fully qualify the path to ebash
in your script. Suppose you
have it installed at /opt/ebash
, then you would do the following:
#!/bin/bash
$(/opt/ebash/bin/ebash --source)
Another very simple approach is to have ebash
in your ${PATH}
and then simply change the interpreter at the top of
your shell script to find ebash
using /usr/bin/env
:
#!/usr/bin/env ebash
Or you can always just give the full path:
#!/opt/ebash/bin/ebash
One of the cool things ebash provides is an interactive REPL interface. This makes it super easy to interactively test out code to see how it behaves or debug failures.
Here's an example:
$ .ebash/bin/ebash
>> ebash ebash="/home/marshall/code/liqid/os/.ebash/share"
ebash> einfo "testing"
>> testing
ebash> assert_true true
ebash> assert_false true
>> assert failed (rc=0) :: true
:: assert.sh:72 | assert_false
:: ebash-repl:64 | repl
:: ebash-repl:91 | main
ebash> exit
marshall@caprica ~/.../liqid/os liqswos-537 v2.4.1.11-1-ge5c6b83156