bash 最简单 kv 数据库

最后更新于:2022-04-02 03:52:58

[TOC] ## 概述 database.sh ``` #!/bin/bash db_set () { echo "$1,$2" >> .database } db_get () { grep "^$1," .database | sed -e "s/^$1,//" | tail -n 1 } ``` 调用 ``` db_set hi 'hello world' db_get hi // hello world // 可覆盖 value 值 db_set hi 'hello world1' db_get hi // hello world1 ```
';