r - Reading user input without echoing -
i'm wondering if there way can read user input stdin without echoing screen in r. know readline()
, readlines()
, scan()
can read in user input keyboard none appear have option not echo back.
as might expect grab password. i'm looking let me do:
> a<-get_password() password: > [1] "password"
what's operating system? if can run terminal, should work.
get_password <- function() { cat("password: ") system("stty -echo") <- readline() system("stty echo") cat("\n") return(a) } > <- get_password() password: > [1] "sdfs" >
this works on os x using r terminal.app, not r.app. no idea on windows solution, since there doesn't seem native r solution.
Comments
Post a Comment