File: libbash.man.in

package info (click to toggle)
libbash 0.9.11-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 764 kB
  • ctags: 50
  • sloc: sh: 1,402; makefile: 51
file content (98 lines) | stat: -rw-r--r-- 2,442 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.\" Process this file with
.\" groff -mdoc -Tascii <filename>
.\"
.Dd @docdate@
.Os Linux
.Dt LIBBASH \&7 "libbash Manual"
.\"
.Sh NAME
.\"
.\"
.Nm libbash
.Nd A bash shared libraries package.
.\"
.\"
.Sh DESCRIPTION
.\"
.\"
.Bd -filled
.Nm
is a package that enables bash dynamic-like shared libraries. Actually its a tool for managing
bash scripts whose functions you may want to load and use in scripts of your own.
.Pp
It contains a 
.Ql dynamic loader 
for the shared libraries (
.Ns Xr ldbash 1 Ns ), a configuration tool ( Ns Xr ldbashconfig 8 Ns ), and some libraries.
.Pp
Using
.Xr ldbash 1 you are able to load loadable bash libraries, such as Xr getopts 1 and Xr hashstash 1 Ns .
A bash shared library that can be loaded using 
.Ed
.Xr ldbash 1 must answer 4 requirments:
.Bl -enum -width 12345
.It 
It must be installed in 
.Fa $LIBBASH_PREFIX Ns /lib/bash (default is /usr/lib/bash).
.It
It must contain a line that begins with 
.Ql #EXPORT= .
That line will contain (after the 
.Ql = Ns
) a list of functions that the library exports.
I.e. all the function that will be usable after loading that library will be listed in that line.
.It 
It must contain a line that begins with 
.Ql #REQUIRE= .
That line will contain (after the 
.Ql = Ns
) a list of bash libraries that are required for our library.
I.e. every bash library that is in use in our bash library must be listed there.
.It 
The library must be listed (For more information, see 
.Xr ldbashconfig 8 Ns ). 
.El
.Pp
.Ss Basic guidelines for writing library of your own:
.Bl -enum -width 12345
.It 
Be aware, that your library will be actually sourced. So, basically, it should contain (i.e define) only
functions.
.It 
Try to declare all variables intended for internal use as local.
.It 
Global variables and functions that are intended for internal use (i.e are not defined in
.Ql #EXPORT= )
should begin with:
.Dl Sy __<library_name>_
For example, internal function 
.Em myfoosort
of 
.Em hashstash
library should be named as
.Dl Sy __hashstash_myfoosort
This helps to avoid conflicts in global name space when using libraries that come from different
vendors.
.It
See html manual for full version of this guide.
.El
.\"
.\"
.Sh AUTHORS
.\"
.\"
.An "Hai Zaar" Aq haizaar@haizaar.com
.An "Gil Ran" Aq ril@ran4.net
.\"
.\"
.Sh SEE ALSO
.\"
.\"
.Xr ldbash 1 ,
.Xr ldbashconfig 8 ,
.Xr getopts 1 ,
.Xr hashstash 1
.Xr colors 1
.Xr messages 1
.Xr urlcoding 1
.Xr locks 1