Next: Timers, Previous: Environment Variables, Up: The language [Contents][Index]
As noted earlier any unused command line arguments are made available
to scripts through the command-line-args variable
(see Invocation).
The list of unused command line arguments, in their original order.
The get-command-line-option function may be used to scan this
list of arguments. The rep.system module exports this function.
Returns t if option was specified on the command line (option is typically a phrase beginning with ‘--’).
If requires-arg is true, the option requires a parameter, the value of which is returned. If a parameter isn’t supplied an error is signalled.
(setq command-line-args '("--foo" "bar"))
⇒ ("--foo" "bar")
(get-command-line-option "--foo" t)
⇒ "bar"
command-line-args
⇒ ()
(setq command-line-args '("--foo=bar"))
⇒ ("--foo=bar")
(get-command-line-option "--foo" t)
⇒ "bar"
command-line-args
⇒ ()