Home > Back-end >  How do I prevent a bash script from exiting?
How do I prevent a bash script from exiting?

Time:06-19

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?

CodePudding user response:

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 "$@"
  • Related