gpt4 book ai didi

shell - 执行脚本后如何恢复 shell 提示符

转载 作者:行者123 更新时间:2023-12-01 07:27:54 26 4
gpt4 key购买 nike

我需要一些帮助才能恢复提示,现在我正在执行此 block ,不要让我恢复提示,我在运行末尾使用 &将此命令作为后台任务。执行脚本后如何返回提示符。

#!/bin/sh
sudo su - user << EOF
nohup program -p4xxx &
EOF

注意:如果我按 ctrl + c - 终止程序。

提前谢谢您。

最佳答案

未经测试,我想知道您是否想要这个:

#!/bin/bash
nohup sudo -u user program -p4xxx &
disown

这将使 sudo 进程进入后台,并将其与调用 shell(脚本)解除关联。

关于shell - 执行脚本后如何恢复 shell 提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38057259/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com