rc scripting trouble with quotes
Murk Fletcher
murk.fletcher at gmail.com
Tue Jun 7 13:49:04 UTC 2016
For what it's worth I ended up with the whole function thing and it's
working perfectly:
dummy_stop() {
cd ${myapp} &&
${myapp} stop &&
kill -9 "$(cat -- ${myapp}/tmp/pids/example.pid)"
}
stop_cmd="dummy_stop"
Thanks!
--Murk
On Tue, Jun 7, 2016 at 2:04 PM, Murk Fletcher <murk.fletcher at gmail.com>
wrote:
> 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
>
>
More information about the freebsd-questions
mailing list