3

I am trying to run multiple commands from a bash file of sqlite3 on ubuntu 15.10. The code is to pull the passwords from the user's google chrome and email it to them. I have everything but the sqlite3 part down. I'm trying to make this as simple and as easy to use for them as possible. I don't know sqlite3 and it's kicking my tail. How would I produce a bash file using this sqlite3 code?

sqlite3 'Login Data'
.mode csv
.headers on
.separator ","
.output UsersPW.csv
select * from logins;
.exit
4
  • Please isolate and show us the complete SQLite code you want to run. And then the question can focus on how to execute the code from a bash script. Commented Jan 6, 2016 at 4:02
  • What's the question here? How to embed that set of commands into a single-line command usable in a script? Commented Jan 6, 2016 at 4:05
  • I am trying to export the login information separated by ,. The code above, if typed one item at a time works the way I want it to, but I can't figure out how to do it in a bash. Commented Jan 6, 2016 at 4:06
  • etan reisner, I believe so. I'm new to sqlite3 and I need some help. Commented Jan 6, 2016 at 4:07

1 Answer 1

2

The answer was simple enough. Inside batch you can echo large data with << EOF structure.

sqlite3 'Login Data' << EOF
.mode csv 
.headers on 
.separator "," 
.output UserPW.csv 
select * from logins; 
.exit
EOF

This created the results I was needing.

Sign up to request clarification or add additional context in comments.

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.