Skip to contents

rscript_filename() returns the file name of the calling script as it was passed to Rscript or littler. OptionParser() uses it as the default program name.

Usage

rscript_filename(quote = NA, type = c("sh", "csh", "cmd", "cmd2"))

Arguments

quote

Whether to quote the file name for a shell. If TRUE always quote it with base::shQuote(), if NA (the default) only quote it if needed with shell_quote(), and if FALSE never quote it.

type

The type of shell quoting passed on to base::shQuote() or shell_quote(). See shell_quote() for the default.

Value

A string with the file name of the calling script. If not found (e.g. you are in an interactive session) returns NA_character_.

See also

Examples

rscript_filename()
#> [1] NA