在sqlite3中显示多行消息

时间:2019-06-19 03:35:51

标签: bash sqlite command-line echo multiline

我正在尝试使用echocatreadprintf命令在sqlite3中显示一些多行消息,但是我总是遇到错误。我想要的输出是这样的:

display the table in a text file:
.once -e
SELECT * from table1;

display the table in a spreadsheet:
.once -x
SELECT * from table1;

我尝试过,但是每个命令都会使输出混乱:

.shell echo "display the table in a text file:"
.shell echo ".once -e"
.shell echo "SELECT * from table1;"

.shell echo "display the table in a spreadsheet:"
.shell echo ".once -x"
.shell echo "SELECT * from table1;"

所以我尝试了:

.shell cat << EndOfMessage
display the table in a text file:
.once -e
SELECT * from table1;

display the table in a spreadsheet:
.once -x
SELECT * from table1;
EndOfMessage
;

和:

.shell read -r -d '' VAR << EndOfMessage

display the table in a text file:
.once -e
SELECT * from table1;

display the table in a spreadsheet:
.once -x
SELECT * from table1;

EndOfMessage
;
.shell echo "$VAR"

但都给出了几个错误。

0 个答案:

没有答案