Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
启动bash subshell并在脚本中运行命令_Bash_Pipenv_Mkdocs - Fatal编程技术网

启动bash subshell并在脚本中运行命令

启动bash subshell并在脚本中运行命令,bash,pipenv,mkdocs,Bash,Pipenv,Mkdocs,我想编写一个shell脚本,它执行以下操作: 激活虚拟环境 运行mkdocs serve,启动本地开发服务器以获取我的文档 如果我做了一件幼稚的事并把它写进我的剧本: cd <my-docs-directory> pipenv shell mkdocs serve Pipenv允许您在虚拟环境中运行命令,而无需启动shell: $ pipenv run <insert command here> exec用于用命令替换当前的shell进程,这样父进程就可以运行,而子进

我想编写一个shell脚本,它执行以下操作:

激活虚拟环境 运行mkdocs serve,启动本地开发服务器以获取我的文档 如果我做了一件幼稚的事并把它写进我的剧本:

cd <my-docs-directory>
pipenv shell
mkdocs serve
Pipenv允许您在虚拟环境中运行命令,而无需启动shell:
$ pipenv run <insert command here>
exec用于用命令替换当前的shell进程,这样父进程就可以运行,而子进程拥有pid。这里有一个关于阿斯库本图的新闻。
您可以使用以下命令:

$ pipenv run <insert command here>
$ bash -c "echo hello"
hello
pipenv run bash -c 'mkdocs serve ; exec bash --norc'