简体   繁体   中英

OS X run and detach script from current shell

I need to launch a script that will act like a daemon from another script and will not prevent me from being able to close Terminal window.

在此处输入图片说明

I tried these standard solutions inside my script :

./myscript.sh arg1 arg2 &

Or this

nohup ./myscript.sh arg1 arg2 &

but they all prevent me from being able to close Terminal window I don't need any output from that subsidiary script.

Do you know a way to do that in standard UNIX shell, or if I can find some builtin commands or services on Mac to ask to run that script on my behalf.

Thanks

This might work:

xterm -e 'sh /path/to/script.sh' &

You may also want to include the -hold option as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM