'Shell script to create a yml file removes data after "$"

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



Solution 1:[1]

Escape ("\") the $ sign.

cat <<EOF>/test/queryTest.yml

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pankaj