Reputation: 1624
I am trying to generate a .js file based on the shell variable following this SO. However, the script still create the file with APP_VERSION: $bumped_version
This is my script:
version=9.9.9
cat > ./constant/app.js <<'msg'
export default Object.freeze({
APP_VERSION: $bumped_version
})
msg
generated app.js:
export default Object.freeze({
APP_VERSION: $bumped_version
})
Thanks for helping!
Upvotes: 0
Views: 1434
Reputation: 930
Heredocs can be used in a few different ways:
cat <<EOF
...
EOF
cat <<-EOF
[tab][tab]...
[tab]EOF
cat <<'EOF'
...
EOF
You can also combine 2 and 3.
Upvotes: 4