2 ms·
Let's optimize! #!/bin/bash db_set () { echo "$1,$2" >> database } db_get () { # read database line by line in reverse, stopp
by pmccarren 8y ago
Let's optimize!
#!/bin/bash
db_set () {
echo "$1,$2" >> database
}
db_get () {
# read database line by line in reverse, stopping at first match
tac database | grep -m 1 "^$1," | sed -e "s/^$1,//"
}