getenv(var)
In all cases, the returned vector has a names attribute which holds the variable names.
getenv("HOME") getenv("S_PRINT_ORIENTATION") # might return "landscape" (on Unix) shome <- "SHOME" getenv(shome) # returns character string of the S-PLUS home directory all.env <- getenv() # whole environment leading.S <- grep("^S", names(all.env)) # index into all.env for those names starting with 'S' all.env[leading.S] # values of these variables; names are preserved getenv(c("S_PATH", "S_FIRST")) getenv()[c("S_PATH", "S_FIRST")] # same thing