【问题标题】:Output of a shell script is another shell scriptshell 脚本的输出是另一个 shell 脚本
【发布时间】:2013-02-14 10:36:21
【问题描述】:

我有一个 shell 脚本,可以将另一个 shell 脚本打印到标准输出。我需要使用单行 bash 命令执行这两个脚本(初始脚本和输出脚本)。有可能吗?

【问题讨论】:

  • 你能详细说明一下,which will print another shell script to stdout 到底是什么意思
  • @Incognito: 哪一部分不清楚?
  • 例如,1.sh = echo "ls"。所以我有两个执行 1.sh 将打印/生成一个新脚本,我必须运行该脚本。在示例中,最终输出应该是 ls 的输出。 (1.sh可以生成多行脚本)

标签: bash shell


【解决方案1】:

也许是这样的:

sh ./test.sh | sh

【讨论】:

    【解决方案2】:

    尝试这样做:

    bash test.bash | bash -s
    

    【讨论】:

      最近更新 更多