Question

I have the following shell script

cat <<EOF | sqlite3 /path/to/my/db.sqlite
.mode line;
select item from mytable;
EOF

When running the script with output redirection, I get this error:

Error: mode should be one of: column csv html insert line list tabs tcl

This happens also when I try different modes. When I run the script without output redirection (printing to terminal), it works fine. What's going on?

Was it helpful?

Solution

Figured it out-- actually the same error was being thrown without output redirection, but I was missing it because normal output was being dumped to the screen instead of a file. The problem in my script is that there should be no ; after mode line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top