-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexey Gladkov <[email protected]>
- Loading branch information
Showing
24 changed files
with
370 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ are Copyright (C) 2008 Stanislav Ievlev <[email protected]>, | |
The files | ||
shell-version, shell-cmdline, shell-config, shell-error, | ||
shell-ip-address, shell-mail-address, shell-unittest, | ||
shell-signal, shell-var, shell-source shell-run | ||
shell-signal, shell-var, shell-source, shell-run, | ||
shell-terminfo, shell-temp, shell-git-config | ||
are Copyright (C) 2009-2011 Alexey Gladkov <[email protected]> | ||
|
||
All files in this package may be freely copied under the terms | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
libshell | ||
======= | ||
# libshell | ||
|
||
This project contains common functions for shell projects to increase code reuse. | ||
The libshell is a set of the most commonly-used shell functions. All functions use minimum | ||
of external utilities and written for POSIX shell. | ||
|
||
LICENSE | ||
------- | ||
## Install | ||
|
||
Install dependencies: | ||
|
||
- coreutils | ||
- [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (optional: man pages) | ||
|
||
## Documentation | ||
|
||
See [docs](docs/libshell.md) | ||
|
||
## LICENSE | ||
|
||
Libshell is licensed under the GNU General Public License version 2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
shell-???(3) | ||
|
||
# NAME | ||
|
||
# SYNOPSIS | ||
|
||
# DESCRIPTION | ||
|
||
# ENVIRONMENT | ||
|
||
# AUTHOR | ||
Authors and contributors of the programs included in the *libshell* package are listed | ||
in the COPYING file. | ||
|
||
# BUGS | ||
Report bugs to the authors. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# libshell | ||
|
||
The libshell is a set of the most commonly-used shell functions. All functions use minimum | ||
of external utilities and written for POSIX shell. | ||
|
||
The main idea is to get rid of implementing these functions in shell-scripts again and again, | ||
and also to protect from common mistakes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,37 @@ | ||
% LIBSHELL | ||
% 3 | ||
% October 2016 | ||
% libshell | ||
% Linux Programmer's Manual | ||
libshell(3) | ||
|
||
# NAME # | ||
# NAME | ||
libshell - the library of shell functions. | ||
|
||
# DESCRIPTION # | ||
# DESCRIPTION | ||
The libshell is a set of the most commonly-used shell functions. All functions use minimum | ||
of external utilities and written for POSIX shell. | ||
|
||
The main idea is to get rid of implementing these functions in shell-scripts again and again, | ||
and also to protect from common mistakes. | ||
|
||
# STRUCTURE # | ||
# STRUCTURE | ||
The library has modular structure. Each module used for own special purpose. | ||
Some modules use the functionality of each other and load the necessary dependence. | ||
|
||
# USAGE # | ||
All libshell modules **MUST** be kept in the PATH and could be not executable. It really helps to include | ||
# USAGE | ||
All libshell modules *MUST* be kept in the PATH and could be not executable. It really helps to include | ||
these modules in the shell-program: | ||
|
||
```bash | ||
``` | ||
#!/bin/sh | ||
. shell-error | ||
. shell-getopt | ||
# something useful ... | ||
``` | ||
|
||
The **bash-completion** will not find these modules in the PATH, if they are not executable. | ||
The *bash-completion* will not find these modules in the PATH, if they are not executable. | ||
|
||
# AUTHOR # | ||
Authors and contributors of the programs included in the **libshell** package are listed | ||
# AUTHOR | ||
Authors and contributors of the programs included in the *libshell* package are listed | ||
in the COPYING file. | ||
|
||
# BUGS # | ||
# BUGS | ||
Report bugs to the authors. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,46 @@ | ||
% SHELL-CMDLINE | ||
% 3 | ||
% October 2016 | ||
% libshell | ||
% Linux Programmer's Manual | ||
shell-cmdline(3) | ||
|
||
# NAME # | ||
# NAME | ||
|
||
cmdline_foreach, cmdline_get - parses and get values from `/proc/cmdline` | ||
|
||
# SYNOPSIS # | ||
# SYNOPSIS | ||
|
||
- cmdline_foreach "proc-cmdline-data" "handler-function" | ||
- cmdline_get "name-for-result" "name" ["proc-cmdline-data"] | ||
|
||
# DESCRIPTION # | ||
# DESCRIPTION | ||
Collection of functions to parse and get values from `/proc/cmdline`. Because `/proc/cmdline` isn't | ||
just shell command line we need to parse it differently. This string can have repetitions of parameters, | ||
and only the last value makes sense, parameter names may contain characters illegal characters | ||
for variables in a shell. | ||
|
||
## cmdline_foreach ## | ||
Function runs **handler-function** for each variable in **proc-cmdline-data**. | ||
## cmdline_foreach | ||
Function runs *handler-function* for each variable in *proc-cmdline-data*. | ||
Returns nothing. | ||
|
||
## cmdline_get ## | ||
Function finds specified by **name** variable in `/proc/cmdline` or in **proc-cmdline-data** | ||
and stores result into variable passed by **name-for-result**. | ||
## cmdline_get | ||
Function finds specified by *name* variable in `/proc/cmdline` or in *proc-cmdline-data* | ||
and stores result into variable passed by *name-for-result*. | ||
Usage example: | ||
|
||
```bash | ||
``` | ||
read cmdline < /proc/cmdline | ||
cmdline_get 'initrd_value' 'initrd' "$cmdline" | ||
echo "$initrd_value" | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
``` | ||
cmdline_get 'initrd_value' 'initrd' | ||
echo "$initrd_value" | ||
``` | ||
|
||
# AUTHOR # | ||
Authors and contributors of the programs included in the **libshell** package are listed | ||
# AUTHOR | ||
Authors and contributors of the programs included in the *libshell* package are listed | ||
in the COPYING file. | ||
|
||
# BUGS # | ||
# BUGS | ||
Report bugs to the authors. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,39 @@ | ||
% SHELL-CONFIG | ||
% 3 | ||
% October 2016 | ||
% libshell | ||
% Linux Programmer's Manual | ||
shell-config(3) | ||
|
||
# NAME # | ||
# NAME | ||
|
||
shell_config_comment, shell_config_del, shell_config_get, shell_config_set - functions | ||
to work with a shell-like config files. | ||
|
||
# SYNOPSIS # | ||
# SYNOPSIS | ||
|
||
- shell_config_comment "file" "name" ["delim"] | ||
- shell_config_del "file" "name" ["delim"] | ||
- shell_config_get "file" "name" ["delim"] | ||
- shell_config_set "file" "name" "value" ["read-delim" ["write-delim"]] | ||
|
||
# DESCRIPTION # | ||
# DESCRIPTION | ||
functions to work (read, change and remove variables) with a shell-like config files. | ||
|
||
## shell_config_comment ## | ||
Function puts **name** variable under comment in the config **file**. | ||
## shell_config_comment | ||
Function puts *name* variable under comment in the config *file*. | ||
Optionally, you can define custom delimeter between name and value. | ||
|
||
## shell_config_del ## | ||
Function removes all entries (not commented) of **name** variable in the config **file**. | ||
## shell_config_del | ||
Function removes all entries (not commented) of *name* variable in the config *file*. | ||
Optionally, you can define custom delimeter between name and value. | ||
|
||
## shell_config_get ## | ||
Function searches for the **name** variable in the config **file**. Optionally, you | ||
## shell_config_get | ||
Function searches for the *name* variable in the config *file*. Optionally, you | ||
can define custom delimeter between name and value. | ||
|
||
## shell_config_set ## | ||
Function adds or uncomments **name** variable in the config **file**. | ||
## shell_config_set | ||
Function adds or uncomments *name* variable in the config *file*. | ||
|
||
# AUTHOR # | ||
Authors and contributors of the programs included in the **libshell** package are listed | ||
# AUTHOR | ||
Authors and contributors of the programs included in the *libshell* package are listed | ||
in the COPYING file. | ||
|
||
# BUGS # | ||
# BUGS | ||
Report bugs to the authors. | ||
|
Oops, something went wrong.