2

I don't want to run these commands manually. How can I automate that in bash script?

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

2 Answers 2

2

I use 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
Sign up to request clarification or add additional context in comments.

Comments

2

Just do:

sqlite3 /path/to/file.db "$command"

From your command prompt.

For example:

sqlite3 /var/lib/pve-cluster/config.db "select * from tree where name = 'corosync.conf';"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.