Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jun 2016 15:49:01 +0200
From:      Murk Fletcher <murk.fletcher@gmail.com>
To:        User Questions <freebsd-questions@freebsd.org>
Subject:   Re: rc scripting trouble with quotes
Message-ID:  <CAH=3fOOX9wP9N5RGYJr6VrL1Qr_PYH8MbtSv_xc_FcwASNgD3A@mail.gmail.com>
In-Reply-To: <CAH=3fONuy_afgSHGMO7YafN2cX8O9V9ULV3-%2BQq86eRxaJXysw@mail.gmail.com>
References:  <CAH=3fONuy_afgSHGMO7YafN2cX8O9V9ULV3-%2BQq86eRxaJXysw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH=3fOOX9wP9N5RGYJr6VrL1Qr_PYH8MbtSv_xc_FcwASNgD3A>