[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Argument to start_daemon, use of --

Malte Forkel wrote:
> The example init script init.d.lsb.ex provided by dh-make 0.46 contains
> this call to start_daemon:
>    start_daemon -p $PIDFILE $DAEMON -- $DAEMON_OPTS
> This always passes "--" as first argument to my daemon. Wouldn't
>    start_daemon -p $PIDFILE -- $DAEMON $DAEMON_OPTS
> be the proper call?

It does seem that way to me too.

> I haven't found a reference to "--" in the LSB init function
> documentation, but the implementation of start_daemon in
> /lib/lsb/init-function (from lsb-base) handles "--" explicitly. The use
> of "--" is documented in bash(1) though. Is this a convention? What
> status has it?

It was a convention and is now a standard.


  Guideline 10:
    The argument -- should be accepted as a delimiter indicating the
    end of options.  Any following arguments should be treated as
    operands, even if they begin with the '-' character.  The --
    argument should not be used as an option or as an operand.

It marks the end of option argument processing.  Subsequent arguments
should not be treated as options even if they start with a dash.  This
enables processing of files that begin with a dash.  Like this for

  $ touch ./--help
  $ rm -f -- --help


Attachment: signature.asc
Description: Digital signature

Reply to: