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
bpkg install reddec/bash-db
make install
git clone https://github.com/reddec/bash-db
cd bash-db
chmod +x db.sh
cp db.sh /usr/local/bin/db
db <method> <database> [arguments...]
Methods:
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. |
db put test.db name 'Red Dec'
Get value of record by key
Arg | Description |
---|---|
key (required) |
Unique key. Can be used any value (also spaces if value in bracets) |
db get test.db name
Get all keys in database
No arguments
db list test.db
Get the value of the last added record
No arguments
db last test.db
Delete record by key
Arg | Description |
---|---|
key (required) |
Unique key. Can be used any value (also spaces if value in bracets) |
db delete test.db name