bash - 在 sqlite3 中显示多行消息
问题描述
我正在尝试使用、、、和命令在 sqlite3 中显示一些多行消息,echo
但我cat
总是有错误。我想要的输出是这样的:read
printf
在文本文件中显示表格: .once -e 从表 1 中选择 *; 在电子表格中显示表格: .一次-x 从表 1 中选择 *;
我试过这个,但每个命令都会使输出混乱:
.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"
但两者都给出了几个错误。
解决方案
推荐阅读
- vue.js - VueJS3:从路由定义中传递数据
- google-apps-script - 如何使用 Googlesheet 公式获取股票历史数据
- c# - 为什么 TextWriter 记录到文件不完整?
- javascript - 如何根据点击的位置获取内部 html?
- ffmpeg - 在ffmpeg中覆盖带有多个文本的字幕
- php - Paypal Orders API 混合单一&订阅购买
- php - NGINX - 从上游读取时拒绝重命名权限
- python - Windows 10 IIS 服务器上的 Python Flask 托管
- r - R如何在新列中获得afinn分数
- java - 将每个字符转换为另一个一致的字符