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
- Host: GitHub
- URL: https://github.com/reddec/bash-db
- Owner: reddec
- License: mit
- Created: 2014-11-12T07:28:07.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-09-26T01:40:15.000Z (almost 3 years ago)
- Last Synced: 2025-07-02T11:01:56.761Z (12 months ago)
- Language: Shell
- Size: 5.86 KB
- Stars: 34
- Watchers: 6
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```