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

https://github.com/reddec/bash-db

Very simple Key-Value database on bash script
https://github.com/reddec/bash-db

Last synced: 12 months ago
JSON representation

Very simple Key-Value database on bash script

Awesome Lists containing this project

README

          

bash-db
=======

Very simple Key-Value database on bash script. Depends on pre-installed software only (tested on Ubuntu 14.04 LTS):
* sed
* bash
* grep
* base64
* xargs

Install
=======

### bpkg (global package)
```bash
bpkg install reddec/bash-db
```

### Make (/usr/local/bin)
```bash
make install
```

### Manual Installation
```bash
git clone https://github.com/reddec/bash-db
cd bash-db
chmod +x db.sh
cp db.sh /usr/local/bin/db
```

Usage
=======

### Command-line Tool
`db [arguments...]`

Methods:

### PUT

Insert or update record.

| Arg | Description |
|-------------------| -------------|
| `key` (required) | Unique key. Can be used any value (also spaces if value in bracets)
| `value` (optional)| Value of record. Can be used any value (also spaces if value in bracets). If value not set, STDIN will be used.

#### Example:

```bash
db put test.db name 'Red Dec'
```

### GET

Get value of record by key

| Arg | Description |
|-------------------| -------------|
| `key` (required) | Unique key. Can be used any value (also spaces if value in bracets)

#### Example:

```bash
db get test.db name
```

### LIST

Get all keys in database

**No arguments**

#### Example:

```bash
db list test.db
```

### LAST

Get the value of the last added record

**No arguments**

#### Example:

```bash
db last test.db
```

### DELETE

Delete record by key

| Arg | Description |
|-------------------| -------------|
| `key` (required) | Unique key. Can be used any value (also spaces if value in bracets)

#### Example:

```bash
db delete test.db name
```