shell脚本创建YML文件将在“ $”之后删除数据。

发布于 2025-01-29 05:16:53 字数 309 浏览 4 评论 0原文

我正在尝试从包含SQL查询的Shell脚本中创建YML文件。 示例脚本

cat <<EOF>/test/queryTest.yml

This is a test
sql: "select * from schema.table$name"

这是我运行shell脚本并检查yml文件后的 ,删除了“ $”之后的任何内容 这是我的YML,

This is a test
sql: select * from schema.table

我很感激如何避免这种想法

I am trying to create a yml file from a shell script which includes a sql query.
This is the sample script

cat <<EOF>/test/queryTest.yml

This is a test
sql: "select * from schema.table$name"

After I run the shell script and check the yml file, anything after "$" is removed
This is my yml

This is a test
sql: select * from schema.table

I would appreciate any thoughts on how to avoid this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剧终人散尽 2025-02-05 05:16:53

逃脱(“ \”)$标志。

cat <<EOF>/test/queryTest.yml

This is a test
sql: "select * from schema.table\$name"

Escape ("\") the $ sign.

cat <<EOF>/test/queryTest.yml

This is a test
sql: "select * from schema.table\$name"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文