From owner-freebsd-questions@freebsd.org Tue Jun 7 13:49:04 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50730B6EA25 for ; Tue, 7 Jun 2016 13:49:04 +0000 (UTC) (envelope-from murk.fletcher@gmail.com) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE4C31229 for ; Tue, 7 Jun 2016 13:49:03 +0000 (UTC) (envelope-from murk.fletcher@gmail.com) Received: by mail-wm0-x22a.google.com with SMTP id v199so20548509wmv.0 for ; Tue, 07 Jun 2016 06:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=zzFd5MvNN1xZrsnoLAoMZ3wCqcRcP+FsEzS/3NGEiRs=; b=mysVhBQpxcn3Nu5jnP8fAmdJwG/1myVtsLXz68iJF8/Z2XLuNftuYhvshx39flzUWL aweHf0/9JCCvrEyDJBhSDzdMkm/ImFEHDgRkmwj+8MXHE+6hZvzk/3I4eabn05nrwSE4 mAp5oPe2EOp4A2M0W5pOSv2flFPibrV1Hg+EoHevTPxfTZ6waquxVrmWRcf65sLpUOZj Oyqo6wD7DJkmj90ZEASmxgWYnohtHwYzPrpgv6fMwl15DQ+F7Oz5Aetddvkd3UA+0QoF sNKCeiHmH0CXYcdGs71OvcEFrCtDzrkbn17/2gK+KNcjSxMfFH0EdZXu1GZgdMj0sLAP n9Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=zzFd5MvNN1xZrsnoLAoMZ3wCqcRcP+FsEzS/3NGEiRs=; b=ZDOTICHLDeR8VMZcr8Q5eWxBkH/Iu2AfkijcWo835XQDJHzRkRrK7aKGzl1XXQ4yAi ME6iPQPvP/etYf7hjZ4i0b11U+LOsSC6TLCWAKMvNncJXnQ1Hd6Se/B7I9jJdNaHGxd6 1h2HaQgVqXFHE7qxFPUlMAwKDy1WaCKsed3qHxfzfmppb8sFDPB2pd8lcSHdawJVxU+z SVmNDoVbG7Y4McvFs8wVAKczGBcoxPNblZpuUdH6gVuf7OW+K20K/SW5vHf8NoRyHTlu SY+jAFY192dQU0LJiFVoQJAW0y1wmB7VM2714888+g8gEov0KufAxF6UZ0IFYMcSlS1v ObpA== X-Gm-Message-State: ALyK8tK3Y5e7XJPoTxEb9yzZj528QJKqwngdMxmrMrcW+55ZfoYRFIK7MS+M2AgJhtYMseY4liAEtMa7HO6BEQ== X-Received: by 10.28.92.20 with SMTP id q20mr2951810wmb.76.1465307342485; Tue, 07 Jun 2016 06:49:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.112.36 with HTTP; Tue, 7 Jun 2016 06:49:01 -0700 (PDT) In-Reply-To: References: From: Murk Fletcher Date: Tue, 7 Jun 2016 15:49:01 +0200 Message-ID: Subject: Re: rc scripting trouble with quotes To: User Questions Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2016 13:49:04 -0000 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 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 > >