From owner-freebsd-questions@freebsd.org Tue Jun 7 12:04:29 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 E3A65B6E840 for ; Tue, 7 Jun 2016 12:04:29 +0000 (UTC) (envelope-from murk.fletcher@gmail.com) Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (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 7E7E51BD0 for ; Tue, 7 Jun 2016 12:04:29 +0000 (UTC) (envelope-from murk.fletcher@gmail.com) Received: by mail-wm0-x231.google.com with SMTP id k204so65971895wmk.0 for ; Tue, 07 Jun 2016 05:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=Fk3sXtD+Kk/kxfut1FNU/AfoZlDdBlP4grZUWVSxQ9g=; b=aZQvn2bPZb8FzIPbMn4a50Vy5DJFNyI/tA8O6NDU4tmNWU1OS11neKx4IqdiK5YWCT 6BzniWxHZskeTTZYR2FFZtgWXId8ajs8+dsvicM74KpHSkNq+EqZYVE06eM2tIcqGgXQ d88+7fU/R9CJajwMioy5t+LKFkiK7u/bYokJIpa62jWS3u9pCID11JtiBLRhwgDFmAXb 4Y8fWMPBPn0M5P6s6MHcPvXhKstRk368QIgDJV4D4n01w8a9LZXg9Mlqh7NN3qH+6dF6 gEqZcvBLIEPHmM+b8bkcKjLhwLVRVNZ/ijnL0XeY3LAIanx1rMzFx4CpJ/FX9DCuti1F 5FEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Fk3sXtD+Kk/kxfut1FNU/AfoZlDdBlP4grZUWVSxQ9g=; b=gwILfVs7dsWRGAZ675+5r66Kt4uMhQLygiDvkqmiTqkzLvgAoZW4zTvLin1ApPYS9w OkTeRVezRiVdDHr3G3zfcpmoFHcXwFeTEQbDaacaFFhnzISbJlP/OBTHHNE4rOln5+Pr QXpCGo66Why1AKEIOcSs8kS9CZLDVZIY/keQm3j/Pw+hN3r87ucJRlOBFpoWchp5PNoj 2rJ1/mCWG4Xy+PaMplj6JUCllZdQOYnLrM1jBh9XJWc+l19vssKFtpmeeAJ2MeCS2lzt 93zBbSkaeS8yfXT0B3Z1plUH3mGHmK7cZqbSA3xnICRHUWWVDOD1/4xwGyaRlfVVucRs QtGw== X-Gm-Message-State: ALyK8tKjYc4uh8iQ9QXAOOvrsQ1oluODQqL405OXOccO6JL1qNaO5l5wWiH7Qhz+RvIpi6p6qNwbTXYPAoq0AQ== X-Received: by 10.194.94.39 with SMTP id cz7mr20394633wjb.135.1465301067830; Tue, 07 Jun 2016 05:04:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.112.36 with HTTP; Tue, 7 Jun 2016 05:04:27 -0700 (PDT) From: Murk Fletcher Date: Tue, 7 Jun 2016 14:04:27 +0200 Message-ID: Subject: 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 12:04:30 -0000 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