# NOT RUN {
# termId has a handle to a previously created terminal
# make sure it is still running before we send it a command
if (!rstudioapi::terminalRunning(termId)) {
rstudioapi::terminalActivate(termId))
# wait for it to start
while (!rstudioapi::terminalRunning(termId)) {
Sys.sleep(0.1)
}
terminalSend(termId, "echo Hello\n")
}
# }
Run the code above in your browser using DataCamp Workspace