如何防止BASH脚本退出?

发布于 2025-02-08 05:49:29 字数 208 浏览 3 评论 0原文

我正在尝试通过向自己发送随机公共地址来增强ngrok http 80

ngrok "$@" &

sendurl()

fg

不幸的是,尽管ngrok屏幕返回在线,但我在bash脚本结束时得到了一个提示,就像终止一样。

如何使Ngrok在终端“ TAB”中运行,就好像我自己启动了吗?

I am trying to augment ngrok http 80 by sending myself the random public address:

ngrok "$@" &

sendurl()

fg

Unfortunately, albeit ngrok screen comes back online, I get a prompt at the end of my bash script, like it terminated.

How do I keep ngrok running in the terminal "tab" as if I started it myself?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

往事风中埋 2025-02-15 05:49:29

这有点黑客,但是您可以使用子壳和小睡眠延迟来获得所需的功能。

(sleep 5 && sendurl(geturl())) & # Customise delay to whatever feels best

ngrok "$@"

This is a bit of a hack but you can use a subshell and a minor sleep delay to get the desired functionality.

(sleep 5 && sendurl(geturl())) & # Customise delay to whatever feels best

ngrok "$@"
小清晰的声音 2025-02-15 05:49:29

将其放在脚本的末尾

while true
do
    echo "Press [CTRL+C] to stop.."
    sleep 1
done

Put this at the end of your script

while true
do
    echo "Press [CTRL+C] to stop.."
    sleep 1
done
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文