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










1















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?










share|improve this question

















  • 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











  • @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















1















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?










share|improve this question

















  • 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











  • @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













1












1








1








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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 12 '17 at 21:35









kennkenn

3211718




3211718







  • 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











  • @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












  • 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











  • @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







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










2 Answers
2






active

oldest

votes


















5














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');"





share|improve this answer























  • 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


















0














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.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    5














    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');"





    share|improve this answer























    • 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















    5














    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');"





    share|improve this answer























    • 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













    5












    5








    5







    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');"





    share|improve this answer













    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');"






    share|improve this answer












    share|improve this answer



    share|improve this answer










    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 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
















    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













    0














    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.






    share|improve this answer



























      0














      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.






      share|improve this answer

























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        jcomeau_ictxjcomeau_ictx

        20018




        20018



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

            Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

            Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.