문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top