Murk Fletcher
2016-06-07 12:04:27 UTC
Hi!
How do I access a variable inside quotes? Right now I'm having some
difficulties:
stop_cmd="cd ${myapp} && \
${myapp} stop && \
kill -9 `cat ${myapp}/tmp/pids/example.pid`"
Returns:
cat: ${myapp}/tmp/pids/example.pid: No such file or directory
I hear it would work better with double quotes, but that would add a
double-double quote at the end:
stop_cmd="cd ${myapp} && \
${myapp} stop && \
kill -9 "$(cat -- ${myapp}/tmp/pids/example.pid)""
Is there a way I could wrap the contents of `stop_cmd` inside a function or
something?
Thanks!
--Murk
https://freebsd.org/doc/en/articles/rc-scripting/rcng-dummy.html
How do I access a variable inside quotes? Right now I'm having some
difficulties:
stop_cmd="cd ${myapp} && \
${myapp} stop && \
kill -9 `cat ${myapp}/tmp/pids/example.pid`"
Returns:
cat: ${myapp}/tmp/pids/example.pid: No such file or directory
I hear it would work better with double quotes, but that would add a
double-double quote at the end:
stop_cmd="cd ${myapp} && \
${myapp} stop && \
kill -9 "$(cat -- ${myapp}/tmp/pids/example.pid)""
Is there a way I could wrap the contents of `stop_cmd` inside a function or
something?
Thanks!
--Murk
https://freebsd.org/doc/en/articles/rc-scripting/rcng-dummy.html