从另一个脚本创建 bash 脚本的通用方法是什么。
例如:
$./script1 arg1 arg2 > script2
$./script2
$arg1 arg2
Run Code Online (Sandbox Code Playgroud)
我可以想到一些方法,例如简单地回显输出,但我想知道是否有更好的方法或我不知道的命令,而谷歌搜索并不是很有帮助。
在此先感谢您的任何帮助。
从第一个脚本输出的任何方式都可以工作,因此echo或cat使用heredoc应该没问题:
cat << EOT
these will be
the lines of
the second script
EOT
Run Code Online (Sandbox Code Playgroud)