有光泽的bash脚本系统命令的范围规则

时间:2017-09-04 12:45:49

标签: bash shiny system

我想在每次用户点击开始时运行bash脚本。下面是一个小例子,但似乎每次用户点击开始按钮时系统命令都无法运行。

server.R

library(shiny)
library(datasets)

function(input, output) {

    # Return the requested dataset
    datasetInput <- reactive({
        switch(input$dataset,
               "rock" = rock,
               "pressure" = pressure,
               "cars" = cars)
    })

    output$summary <- renderPrint({
        dataset <- datasetInput()
        summary(dataset)
    })


    output$bash <- renderPrint({
        system("./test.sh")
        df_1<-data.table::fread("test.txt")
        df_1
    })
}

ui.R

library(shiny)

fluidPage( 
    # Application title
    titlePanel("Shiny Text"),

    # Sidebar with controls to select a dataset and specify the
    # number of observations to view
    sidebarLayout(
        sidebarPanel(
            selectInput("dataset", "Choose a dataset:",
                        choices = c("rock", "pressure", "cars")),
            actionButton("button", "Start")
            ),


        # Show a summary of the dataset and an HTML table with the
        # requested number of observations
        mainPanel(
            verbatimTextOutput("summary"),

            verbatimTextOutput("bash")
        )
    )
)

test.sh

date >> test.txt

0 个答案:

没有答案