Append to "command" in rec script
Carmel NY
carmel_ny at outlook.com
Thu Nov 8 20:52:42 UTC 2018
On Thu, 8 Nov 2018 21:32:09 +0100, Mateusz Piotrowski stated:
>>>On Thu, 8 Nov 2018 18:13:24 +0000, Carmel NY wrote:
>>>> I am attempting to create an "rc" script to start a program I am working
>>>> on. I want, if possible, for the user to enter something in the rc.conf
>>>> file to be added to the "command" string when the program is started.
>>>>
>>>> EXAMPLE:
>>>>
>>>> In the rc script, this is present
>>>>
>>>> command=/usr/local/bin/MyProg
>>>>
>>>> Now, suppose the user wanted to activate logging. They could modify the
>>>> rc script and append an "-l" to the command string. However, I would
>>>> rather they entered options in the rc.conf file
>
>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.
--
Carmel
More information about the freebsd-questions
mailing list