在Bash脚本中模拟提示符处的输入

时间:2018-02-01 03:57:09

标签: bash shell gnome-terminal

如何模拟用户在提示符下键入字符? Bash / gnome-terminal是否具有允许此功能的功能?

例如:

cmake_minimum_required(VERSION 3.1)

# MUST be done before call to 'project'
get_cmake_property(vars CACHE_VARIABLES)
foreach(var ${vars})
  get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING)
    if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "")
        # message("${var} = [${${var}}]  --  ${currentHelpString}") # uncomment to see the variables being processed
        list(APPEND CL_ARGS "-D${var}=${${var}}")
    endif()
endforeach()

project(SuperBuild)

include(ExternalProject)

ExternalProject_Add(ext_proj
  ...

  CMAKE_ARGS ${CL_ARGS}
)

上面,我会运行一个脚本,脚本会输入字母" c"在没有任何用户输入的情况下,在我的下一行。

0 个答案:

没有答案