i am looking to execute the following commands within a shell script:
$ sqlite3 /Users/riceje7/bin/places.sqlite
sqlite > .output places.txt;
sqlite > SELECT url FROM moz_places;
sqlite > .quit;
$ lpr /Users/riceje7/bin/places.txt
howe开发者_运维知识库ver the script stops after the initial sqlite3 command call and only executes the other commands after i manually quit sqlite. does anyone know how i can force the script to execute these commands in this order without having to manually enter them?
You should be doing..
sqlite3 [OPTIONS] FILENAME [SQL]
so...
sqlite3 /Users/riceje7/bin/places.sqlite "SELECT url FROM moz_places" > places.txt
lpr /Users/riceje7/bin/places.txt
Or better yet (unless you need to keep places.txt
for some reason)...
sqlite3 /Users/riceje7/bin/places.sqlite "SELECT url FROM moz_places" | lpr
精彩评论