LP Examples¤
LP Source:
```bash lp asserts=Hello fmt=xt_flat session=foo
echo "Hello World!"
```
Result:
$ echo "Hello World!"
Hello World!
LP Source:
```bash lp asserts=Hello fmt=xt_flat
ls -lta /etc | grep hosts # lp: asserts=hosts
echo "Hello World!" # lp: asserts="[World and Hello] or Foo"
```
Result:
$ ls -lta /etc | grep hosts
-rw-r--r-- 1 root root 484 Apr 11 14:54 hosts
-rw-r--r-- 1 root root 411 Apr 4 21:40 hosts.allow
-rw-r--r-- 1 root root 711 Apr 4 21:40 hosts.deny
$ echo "Hello World!"
Hello World!
Defining a function for later use:
LP Source:
```bash lp new_session=test
say_hello () {
echo -e "Hello, from \n"$(env | grep -i tmux)"";
}
```
Result:
$ say_hello () {
echo -e "Hello, from \n"$(env | grep -i tmux)"";
}
$ say_hello () {
> echo -e "Hello, from \n"$(env | grep -i tmux)"";
> }
$
Heredocs¤
the example includes the previously defined function:
LP Source:
```bash lp session=test asserts=TMUX
echo $0 # lp: expect=bash
export -f say_hello
/bin/bash # lp: expect=
echo $0 # lp: expect=bash
say_hello
R="\x1b["; r="${R}1;31m"
echo -e "Means: We do have
> - $r Cross block sessions ${R}0m
> - $r Blocking commands/subshells ${R}0m
> - and...${R}4m$r Full Ansi
> "
```
Result:
$ echo $0
$ export -f say_hello
$ /bin/bash
$ echo $0
$ say_hello
$ R="\x1b["; r="${R}1;31m"
$ echo -e "Means: We do have
- $r Cross block sessions ${R}0m
- $r Blocking commands/subshells ${R}0m
- and...${R}4m$r Full Ansi
"
$ echo $0
-bash
$
$ export -f say_hello
$ /bin/bash
runner@fv-az177-760:~/work/docutools/docutools$
runner@fv-az177-760:~/work/docutools/docutools$ echo $0
/bin/bash
runner@fv-az177-760:~/work/docutools/docutools$
runner@fv-az177-760:~/work/docutools/docutools$ say_hello
Hello, from
TMUX=/tmp/tmux-1001/default,2649,20 conda_project_tools=tmux poetry graphviz imagemagick TMUX_PANE=%20 TERM_PROGRAM=tmux BASH_FUNC_say_hello%%=() { echo -e "Hello, from
"$(env | grep -i tmux)""
runner@fv-az177-760:~/work/docutools/docutools$ R="\x1b["; r="${R}1;31m"
runner@fv-az177-760:~/work/docutools/docutools$ echo -e "Means: We do have
> - $r Cross block sessions ${R}0m
> - $r Blocking commands/subshells ${R}0m
> - and...${R}4m$r Full Ansi
> "
Means: We do have
- [1m[31m Cross block sessions [0m[39m[49m
- [1m[31m Blocking commands/subshells [0m[39m[49m
- and...[1;4m[31m Full Ansi[0m[39m[49m
[1;4m[31mrunner@fv-az177-760:~/work/docutools/docutools$ [0m[39m[49m
[1;4m[31m
You can tmux att -t
test to inspect what is going on.