Date: Thu, 8 Nov 2018 20:52:40 +0000 From: Carmel NY <carmel_ny@outlook.com> To: FreeBSD <freebsd-questions@freebsd.org> Subject: Re: Append to "command" in rec script Message-ID: <SN1PR20MB21090FA786C48B5CB2E6362A80C50@SN1PR20MB2109.namprd20.prod.outlook.com> In-Reply-To: <20181108213209.159bf8f8@e5500.localdomain> References: <SN1PR20MB2109DD8D5387A977F1F550B480C50@SN1PR20MB2109.namprd20.prod.outlook.com> <20181108193853.ee1404e2.freebsd@edvax.de> <SN1PR20MB21090B23D17CCEBEC43C428380C50@SN1PR20MB2109.namprd20.prod.outlook.com> <20181108213209.159bf8f8@e5500.localdomain>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 8 Nov 2018 21:32:09 +0100, Mateusz Piotrowski stated: >>>On Thu, 8 Nov 2018 18:13:24 +0000, Carmel NY wrote: =20 >>>> I am attempting to create an "rc" script to start a program I am worki= ng >>>> on. I want, if possible, for the user to enter something in the rc.con= f >>>> file to be added to the "command" string when the program is started. >>>>=20 >>>> EXAMPLE: >>>>=20 >>>> In the rc script, this is present >>>>=20 >>>> command=3D/usr/local/bin/MyProg >>>>=20 >>>> Now, suppose the user wanted to activate logging. They could modify th= e >>>> rc script and append an "-l" to the command string. However, I would >>>> rather they entered options in the rc.conf file =20 > >Don't you look for ${name}_flags (see rc.subr(8)). ${name}_flags Arguments to call command with. This is usually set in rc.conf(5), and not in the rc.d(8) script. The environment variable `flags' can be used to override this. That calls "command", it does not append a value to it. I receive an error that "eval" cannot handle it. I am going to try: load_rc_config_var name var Read the rc.conf(5) variable var for name and set in the current shell, using load_rc_config in a sub-shell to prevent unwanted side effects from other variable assignments. --=20 Carmel
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?SN1PR20MB21090FA786C48B5CB2E6362A80C50>