-
Bug
-
Resolution: Not a Bug
-
Normal
-
None
-
rhel-9.3.0
-
None
-
None
-
Moderate
-
sst_cs_plumbers
-
ssg_core_services
-
5
-
False
-
-
None
-
Red Hat Enterprise Linux
-
None
-
None
-
None
-
-
x86_64
-
None
What were you trying to do that didn't work?
When running commands in a script, last command of script returns the PPID of ksh shell's PID instead of script's PID.
Please provide the package NVR for which bug is seen:
ksh-1.0.0~beta.1-3.el9
How reproducible:
Always
Steps to reproduce
- Create a sample script to echo test messages and take ps output redirected :
# cat script.sh echo "test1" ps -ef > out1.log echo "test2" ps -ef > out2.log echo "test3" ps -ef > out3.log # chmod +x script.sh
- Run the script via normal user and grep process information from output files.
$ ./script.sh test1 test2 test3 $ egrep 'ksh|ps -ef|./sc' out1.log UID PID PPID C STIME TTY TIME CMD pj 1510 1509 0 10:12 pts/0 00:00:00 -ks pj 1541 1510 0 10:14 pts/0 00:00:00 ./sc <--- Scripts PID pj 1542 1541 0 10:14 pts/0 00:00:00 ps -ef <--- Matches PPID of ps with script PID $ egrep 'ksh|ps -ef|./sc' out2.log pj 1510 1509 0 10:12 pts/0 00:00:00 -ks pj 1541 1510 0 10:14 pts/0 00:00:00 ./sc <--- Scripts PID pj 1542 1541 0 10:14 pts/0 00:00:00 ps -ef <--- Matches PPID of ps with script PID $ egrep 'ksh|ps -ef|./sc' out3.log pj 1510 1509 0 10:12 pts/0 00:00:00 -ksh <--- In last attempt, script process cant be seen and PID of ksh pj 1541 1510 0 10:14 pts/0 00:00:00 ps -ef <--- Matches PPID of ps with ksh shell PID
- The last command is run via ksh shell instead of script itself and script process seems to be completed by then as last ps could not capture it.
Expected results
The commands run in script should show their Parent Process ID of script.
Actual results
The commands run in script shows Parent Process ID of ksh shell.