ksh script spawns unwanted child with the same name

不问归期 提交于 2019-12-11 15:49:21

问题


So.. I use KSH on Solaris8 for quite long but this is the first time I got something like this:

I start a script - let's call it splitCfg. When I call pgrep -x splitCfg I'm finding two instances of this script - the main instance and a child of my script (output from ps):

root 28069 25107  0 20:22:01 pts/10   0:00 splitCfg
root  4668 28069  0 20:22:50 pts/10   0:00 splitCfg

As you can see - the first instance is a parent for a child. However - there is no subprocess created from the main script. When I call the ps or pgrep or ptree one more time I get: 1. no child process or 2. a new child process

I am looking for some explanation. I believe I've search whole Internet, so it's time to ask all of you for some of your precious time :)

Is it some sort of the KSH bug (note that I'm using pretty old version from Solaris 8) or am I missing something. I understand that single script should create a single PID and leave it when it finishes.

Thanks, Saperzasty


回答1:


If you have parenthesis in your shell script, the subshell may run in a separate Unix process, depending on what ksh version you have. I think ksh88i (a very old version) is still shipping as the system shell on Solaris.



来源:https://stackoverflow.com/questions/2157583/ksh-script-spawns-unwanted-child-with-the-same-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!