Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top