通过 bash 执行 sqlite 命令
Do sqlite commands via bash
我不想 运行 手动执行这些命令。我如何在 bash 脚本中自动执行此操作?
sqlite3 /var/lib/pve-cluster/config.db
sqlite> select * from tree where name = 'corosync.conf';
sqlite> delete from tree where name = 'corosync.conf';
sqlite> select * from tree where name = 'corosync.conf';
sqlite> .quit
就这样:
sqlite3 /path/to/file.db "$command"
从您的命令提示符。
例如:
sqlite3 /var/lib/pve-cluster/config.db "select * from tree where name = 'corosync.conf';"
我用heredocs:
sqlite3 /var/lib/pve-cluster/config.db <<EOF
select * from tree where name = 'corosync.conf';
delete from tree where name = 'corosync.conf';
select * from tree where name = 'corosync.conf';
EOF
我不想 运行 手动执行这些命令。我如何在 bash 脚本中自动执行此操作?
sqlite3 /var/lib/pve-cluster/config.db
sqlite> select * from tree where name = 'corosync.conf';
sqlite> delete from tree where name = 'corosync.conf';
sqlite> select * from tree where name = 'corosync.conf';
sqlite> .quit
就这样:
sqlite3 /path/to/file.db "$command"
从您的命令提示符。
例如:
sqlite3 /var/lib/pve-cluster/config.db "select * from tree where name = 'corosync.conf';"
我用heredocs:
sqlite3 /var/lib/pve-cluster/config.db <<EOF
select * from tree where name = 'corosync.conf';
delete from tree where name = 'corosync.conf';
select * from tree where name = 'corosync.conf';
EOF