Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wick3dr0se/bashin

A minimal BASH framework
https://github.com/wick3dr0se/bashin

bash framework interpreter library script

Last synced: about 2 months ago
JSON representation

A minimal BASH framework

Awesome Lists containing this project

README

        


:crystal_ball: bashin


A minimal BASH framework







Bashin is an extension of BASH intended to be as minimal and clean as possible; Wrote in pure BASH, bashin is super fast

Many scripters resort to slow external commands glued together with pipes and subshells. Of course they have their use cases but generally (for performance sake) they should be avoided

Bashin supports push, pop, cycling arrays and many more array/stack operations. Bashin handles ANSI escape sequences that make coloring, positioning and other terminal modifications much more simple (like building a TUI)

```bash
push 'a' 'b' 'c'

echo "${STACK[@}"
```

> a b c

```bash
stack -r

echo "${STACK[@]}"
```

> c b a

```bash
arr=('a' 'b' 'c')

reverse_array "${arr[@]}"

echo "${REVERSE[@]}"
```

> c b a

```bash
arr1=('a' 'b' 'c') arr2=('a' 'c')

unique "${arr1[*]}" "${arr2[*]}"

echo "${UNIQUE[@]}"
```

> b

— Among many other things; Bashin can be sourced interactively or per script

# Auto Setup
execute the setup.sh script (recommended)

```bash
bash <(curl -s https://raw.githubusercontent.com/wick3dr0se/bashin/main/setup.sh)
```

*the one-liner above will remotely execute the `bashin` setup script - including `bashin`*

## Manual Setup
clone the repository
```bash
git clone https://github.com/wick3dr0se/bashin&& cd "${_##*/}"
```

execute the setup.sh script `bash setup.sh`

otherwise source bashin within another script:
```bash
/bashin
# or
. /bashin
```

source within your ~/.bashrc to use interactively & globally

then use `import_all` or `import` to manually source necessary procs (functions), e.g. `import ansi`

*core libs (scripts) are implicitly imported*

# How to Use

See `usage.sh` for examples and view documentation in the respective library directory