how to pass multiple commands to sqlite3 in a one liner shell command The Next CEO of Stack OverflowHow does this su -c “…” command seem to pass two commands instead of one?How to redirect sqlite3 output to a fileMethod for storing/remembering one liner commandsHow do I decode a list of base64-encoded file names?How to specify PRAGMAs in an sqlite3 command line call?SQLite3 command line: how do you cancel a command?Pass range $XX..$$YY to cp command in bash scriptsqlite3 command line - how to set mode and import in one stepsqlite3 command beeps whenever I press 'b'Pass input to multiple commands and compare their outputs
When you upcast Blindness/Deafness, do all targets suffer the same effect?
Is it okay to majorly distort historical facts while writing a fiction story?
How to delete every two lines after 3rd lines in a file contains very large number of lines?
WOW air has ceased operation, can I get my tickets refunded?
Unclear about dynamic binding
What connection does MS Office have to Netscape Navigator?
Grabbing quick drinks
Why isn't the Mueller report being released completely and unredacted?
Method for adding error messages to a dictionary given a key
Why does standard notation not preserve intervals (visually)
Is a distribution that is normal, but highly skewed considered Gaussian?
Would a completely good Muggle be able to use a wand?
Can MTA send mail via a relay without being told so?
How do I align (1) and (2)?
What is meant by "large scale tonal organization?"
Find non-case sensitive string in a mixed list of elements?
Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis
Necessary condition on homology group for a set to be contractible
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
Is there a way to save my career from absolute disaster?
How to count occurrences of text in a file?
What did we know about the Kessel run before the prequels?
Is there a difference between "Fahrstuhl" and "Aufzug"
Which one is the true statement?
how to pass multiple commands to sqlite3 in a one liner shell command
The Next CEO of Stack OverflowHow does this su -c “…” command seem to pass two commands instead of one?How to redirect sqlite3 output to a fileMethod for storing/remembering one liner commandsHow do I decode a list of base64-encoded file names?How to specify PRAGMAs in an sqlite3 command line call?SQLite3 command line: how do you cancel a command?Pass range $XX..$$YY to cp command in bash scriptsqlite3 command line - how to set mode and import in one stepsqlite3 command beeps whenever I press 'b'Pass input to multiple commands and compare their outputs
I'm trying to save clipboard content into an sqlite database. Created database and tables.
I don't want it to create journal
file in every clipboard change, so I tried to pass PRAGMA journal_mode = OFF;
flag. But it's tricky to pass those commands in a one liner commands because sqlite
only accepts two command like
sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
it works.
I looked for Q&A
sites, some advises echoing the commands in the following way.
echo "PRAGMA journal_mode = OFF;" | sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
But PRAGMA journal_mode = OFF;
doesn't take effect in that way though it works within the sqlite3
command prompt.
What's wrong with my one liner script?
bash shell-script sqlite bash-expansion
add a comment |
I'm trying to save clipboard content into an sqlite database. Created database and tables.
I don't want it to create journal
file in every clipboard change, so I tried to pass PRAGMA journal_mode = OFF;
flag. But it's tricky to pass those commands in a one liner commands because sqlite
only accepts two command like
sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
it works.
I looked for Q&A
sites, some advises echoing the commands in the following way.
echo "PRAGMA journal_mode = OFF;" | sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
But PRAGMA journal_mode = OFF;
doesn't take effect in that way though it works within the sqlite3
command prompt.
What's wrong with my one liner script?
bash shell-script sqlite bash-expansion
3
You should either put all of the commands in throughecho
or all of them as an argument tosqlite3
.
– chicks
Oct 13 '17 at 2:29
@chicks "I believe I tried that but it didn't work in my attempt." you know it's anoob phenomenon
. If you posted it as an answer, I'd have another option.
– kenn
Oct 13 '17 at 11:20
add a comment |
I'm trying to save clipboard content into an sqlite database. Created database and tables.
I don't want it to create journal
file in every clipboard change, so I tried to pass PRAGMA journal_mode = OFF;
flag. But it's tricky to pass those commands in a one liner commands because sqlite
only accepts two command like
sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
it works.
I looked for Q&A
sites, some advises echoing the commands in the following way.
echo "PRAGMA journal_mode = OFF;" | sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
But PRAGMA journal_mode = OFF;
doesn't take effect in that way though it works within the sqlite3
command prompt.
What's wrong with my one liner script?
bash shell-script sqlite bash-expansion
I'm trying to save clipboard content into an sqlite database. Created database and tables.
I don't want it to create journal
file in every clipboard change, so I tried to pass PRAGMA journal_mode = OFF;
flag. But it's tricky to pass those commands in a one liner commands because sqlite
only accepts two command like
sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
it works.
I looked for Q&A
sites, some advises echoing the commands in the following way.
echo "PRAGMA journal_mode = OFF;" | sqlite3 clipboard_archive.db "insert into cb (cb_context) values ('clipboard');"
But PRAGMA journal_mode = OFF;
doesn't take effect in that way though it works within the sqlite3
command prompt.
What's wrong with my one liner script?
bash shell-script sqlite bash-expansion
bash shell-script sqlite bash-expansion
asked Oct 12 '17 at 21:35
kennkenn
3211718
3211718
3
You should either put all of the commands in throughecho
or all of them as an argument tosqlite3
.
– chicks
Oct 13 '17 at 2:29
@chicks "I believe I tried that but it didn't work in my attempt." you know it's anoob phenomenon
. If you posted it as an answer, I'd have another option.
– kenn
Oct 13 '17 at 11:20
add a comment |
3
You should either put all of the commands in throughecho
or all of them as an argument tosqlite3
.
– chicks
Oct 13 '17 at 2:29
@chicks "I believe I tried that but it didn't work in my attempt." you know it's anoob phenomenon
. If you posted it as an answer, I'd have another option.
– kenn
Oct 13 '17 at 11:20
3
3
You should either put all of the commands in through
echo
or all of them as an argument to sqlite3
.– chicks
Oct 13 '17 at 2:29
You should either put all of the commands in through
echo
or all of them as an argument to sqlite3
.– chicks
Oct 13 '17 at 2:29
@chicks "I believe I tried that but it didn't work in my attempt." you know it's a
noob phenomenon
. If you posted it as an answer, I'd have another option.– kenn
Oct 13 '17 at 11:20
@chicks "I believe I tried that but it didn't work in my attempt." you know it's a
noob phenomenon
. If you posted it as an answer, I'd have another option.– kenn
Oct 13 '17 at 11:20
add a comment |
2 Answers
2
active
oldest
votes
Not sure why you want to use SQLite if you don't want the journal (have you considered the much faster WAL mode if speed is a concern?) but you can give multiple commands separated by semicolons:
sqlite3 clipboard_archive.db "PRAGMA journal_mode = OFF; insert into cb (cb_context) values ('clipboard');"
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware ofWAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.
– kenn
Oct 13 '17 at 11:13
add a comment |
derobert's answer doesn't seem to work with dot-commands, but you can use -cmd
: sqlite3 tolls.sql3 -cmd ".mode csv" ".import tolls.csv tolls"
it accepts multiple -csv
commands and executes them in order, before the final arg.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397806%2fhow-to-pass-multiple-commands-to-sqlite3-in-a-one-liner-shell-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Not sure why you want to use SQLite if you don't want the journal (have you considered the much faster WAL mode if speed is a concern?) but you can give multiple commands separated by semicolons:
sqlite3 clipboard_archive.db "PRAGMA journal_mode = OFF; insert into cb (cb_context) values ('clipboard');"
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware ofWAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.
– kenn
Oct 13 '17 at 11:13
add a comment |
Not sure why you want to use SQLite if you don't want the journal (have you considered the much faster WAL mode if speed is a concern?) but you can give multiple commands separated by semicolons:
sqlite3 clipboard_archive.db "PRAGMA journal_mode = OFF; insert into cb (cb_context) values ('clipboard');"
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware ofWAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.
– kenn
Oct 13 '17 at 11:13
add a comment |
Not sure why you want to use SQLite if you don't want the journal (have you considered the much faster WAL mode if speed is a concern?) but you can give multiple commands separated by semicolons:
sqlite3 clipboard_archive.db "PRAGMA journal_mode = OFF; insert into cb (cb_context) values ('clipboard');"
Not sure why you want to use SQLite if you don't want the journal (have you considered the much faster WAL mode if speed is a concern?) but you can give multiple commands separated by semicolons:
sqlite3 clipboard_archive.db "PRAGMA journal_mode = OFF; insert into cb (cb_context) values ('clipboard');"
answered Oct 12 '17 at 22:10
derobertderobert
74.9k8163221
74.9k8163221
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware ofWAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.
– kenn
Oct 13 '17 at 11:13
add a comment |
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware ofWAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.
– kenn
Oct 13 '17 at 11:13
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware of
WAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.– kenn
Oct 13 '17 at 11:13
I just had time to test it, it works, thanks. I am just a beginner in data storing. Thank you for the suggestion, I was not aware of
WAL
mode. I ll take a look at it. My concern was not speed, I didn't want hard disk to wear down.– kenn
Oct 13 '17 at 11:13
add a comment |
derobert's answer doesn't seem to work with dot-commands, but you can use -cmd
: sqlite3 tolls.sql3 -cmd ".mode csv" ".import tolls.csv tolls"
it accepts multiple -csv
commands and executes them in order, before the final arg.
add a comment |
derobert's answer doesn't seem to work with dot-commands, but you can use -cmd
: sqlite3 tolls.sql3 -cmd ".mode csv" ".import tolls.csv tolls"
it accepts multiple -csv
commands and executes them in order, before the final arg.
add a comment |
derobert's answer doesn't seem to work with dot-commands, but you can use -cmd
: sqlite3 tolls.sql3 -cmd ".mode csv" ".import tolls.csv tolls"
it accepts multiple -csv
commands and executes them in order, before the final arg.
derobert's answer doesn't seem to work with dot-commands, but you can use -cmd
: sqlite3 tolls.sql3 -cmd ".mode csv" ".import tolls.csv tolls"
it accepts multiple -csv
commands and executes them in order, before the final arg.
answered 2 days ago
jcomeau_ictxjcomeau_ictx
20018
20018
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397806%2fhow-to-pass-multiple-commands-to-sqlite3-in-a-one-liner-shell-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
You should either put all of the commands in through
echo
or all of them as an argument tosqlite3
.– chicks
Oct 13 '17 at 2:29
@chicks "I believe I tried that but it didn't work in my attempt." you know it's a
noob phenomenon
. If you posted it as an answer, I'd have another option.– kenn
Oct 13 '17 at 11:20