本地没有sqlite3,从服务端copy 一个,但这还不够,查命令的依赖
[root@localhost qinpeng]# ldd sqlite3
linux-vdso.so.1 (0x00007ffe4cb9b000)
libreadline.so.7 => /lib64/libreadline.so.7 (0x00007f1afe8eb000)
libncurses.so.6 => /lib64/libncurses.so.6 (0x00007f1afe6c0000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f1afe493000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1afe111000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f1afdf0d000)
libz.so.1 => /lib64/libz.so.1 (0x00007f1afdcf6000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1afdad6000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1afd711000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1afee7d000)
把这些都带上,不带软连接的就不用拷贝了
对数据库的操作
#!/bin/bash --
## 查询
urls="$(
sqlite3 /home/pi/.newsbeuter/cache.db \
'select url from rss_item where unread = 1 limit 5' \
)"
### 修改
for url in $urls; do
sqlite3 /home/pi/.newsbeuter/cache.db \
"UPDATE rss_item set unread = 0 where url = '$url'"
done
### 打印
for url in $urls; do
echo $url
done