You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
ate is Array Table Extension, which creates and useshigh-performance vector indexes to elements of Bash arrays,permitting instant access to elements for reading and writing,fast sorting and searching using binary-searches for sortedtables.
FEATURES
Bash BuiltinBash builtins can avoid the performance penalty of starting childprocesses, and can initiate script responses through callbacks toscript functions.
C-language Vector of PointersUsing fixed-length memory C structs containing pointers to the Basharray elements permits access to the Bash array elements by indexthrough simple multiplication.
Establishes a Virtual TableThe pointers of the vector can simulate a table by pointing toBash array elements at fixed increments. For example, a tablewhose rows contain three fields will have pointers to everythird Bash array element.
Use Bash Memory ManagementThis is a mixed blessing. Using Bash variables and Bash arraysfor the data permits Bash garbage collection to manage theirlifetimes. The downside is that, without destructors, it isdifficult or impossible to guarantee an orderly release ofno-longer needed memory. Thus the indexes are not dynamic.That is, a table length is fixed until it is explicitely reindexed.
LibraryI'm experimenting with an interface for including Bash scriptfragments ofate solutions and utilities into new Bash scripts.The library interface provides a list of available scriptlets,basic usage info about each scriptlet, and a system for managingincludes without duplicates.
INSTALLATION
Prerequisites
Ensure you have the following:
Bash version4.0.0 or higher
A C-compiler (gcc) for compiling the command
bash_builtins development package
git to clone, build, and statically link afew library dependencies
The development environment is Linux. I should work on any Linuxdistribution, and will probably work on BSD as well (I haven't testedit there yet).
Installation Steps
Clone the repository:
git clone https://github.com/cjungmann/ate.git
Navigate to the cloned directory:
cd ate
Run theconfigure script to resolve dependencies and prepare the Makefile.
./configure
Build and install the builtin:
makesudo make install
Verify the installation by running:
enable ateate list_actions
USAGE
Syntax
ate [action_name] [handle_name] [options]
Example
The following example will make and display anate two-columntable of file names and sizes:
enable atesource<( ate_sources ate_exit_on_error ate_print_formatted_table)# Make a two-field tabledeclare AHANDLEatedeclare AHANDLE 2ate_exit_on_errordeclare namewhile IFS='|'read -r -a row;do ate append_data AHANDLE"${row[@]}"done<<( stat -c"%n|%s"*)ate index_rows AHANDLEate_exit_on_errorate_print_formatted_table AHANDLE
About
Loadable Bash builtin for using an array as a table