Reputation: 679
I need to write both variables like ${myvar} and their values.
This code makes no substitutes and writes text as is:
cat >${PROGNAME_APPDIR}/AppRun <<'EOF'
#!/bin/bash
HERE=$(dirname $(readlink -f "${0}"))
export LD_PRELOAD="${HERE}"/lib/exec_wrapper.so
export BIN_DIR="${HERE}${DIR}"
exec "${BIN_DIR}"/binary "$@"
EOF
When I change << 'EOF'
to << EOF
the code substitutes all. But I need substitute just value of ${DIR}
.
How to make a mixed write without crazy coding?
Upvotes: 0
Views: 51
Reputation: 770
You have to escape the $
sign, change $
to \$
so it is treated as a normal character:
cat >${PROGNAME_APPDIR}/AppRun <<EOF
#!/bin/bash
HERE=\$(dirname \$(readlink -f "\${0}"))
export LD_PRELOAD="\${HERE}"/lib/exec_wrapper.so
export BIN_DIR="\${HERE}${DIR}"
exec "\${BIN_DIR}"/binary "\$@"
EOF
Upvotes: 4