我正在使用 aws ubuntu 实例。我想创建一个别名/函数来运行一些快捷方式,例如在屏幕中激活 python 虚拟环境。
我已经做了这个功能,例如:
# Alias for jupyter notebook
function start_jupyter() {
cd my_path/lab_workspace/ # 1. cd into my workspace
source labworkspaceenv/bin/activate # 2. activate my python virtualenv
screen -S jupyter_lab # 3. start screen
echo 'You are in screen for jupyter lab' # 4. print something
jupyter lab # 5. start jupyter lab
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我用 运行函数时start_jupyter,这似乎在 3. 之后停止。屏幕被创建,但没有打印任何内容并且 jupyterlab 没有启动。
我究竟做错了什么?