Last active
June 19, 2017 11:30
-
-
Save hryniuk/be4539e67cc41cc08f150cb03c2b0d29 to your computer and use it in GitHub Desktop.
Simple BASH database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # copied from https://jvns.ca/blog/2017/06/11/log-structured-storage/ | |
| db_set() { | |
| echo "$1,$2" >> database | |
| } | |
| db_get() { | |
| grep "^$1," database | sed -e "s/^$1,//" | tail -n 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment