ps -ef


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ps -ef
# 1  
Old 01-29-2009
ps -ef

HI

I have a script named xx.ksh located at /aa/ss
Code is like

!#bi/ksh
while true
do
echo bb
done
exit

So code runs in a loop until i stop.

1) cd /aa/ss
next sh xx.ksh

When i check "ps -ef" i can see the process sh xx.ksh

2) now i will be in my home directory by executing "cd"
next /aa/ss/xx.ksh

When i check "ps -ef " i couldnt see the process.

Where can i find the process ID?

Please help
# 2  
Old 01-29-2009
Try ps -efx |grep xx.ksh


That's just off the top of my skull...assuming you're not changing something between commands.
# 3  
Old 01-29-2009
Just a quick look at your code there are some mistakes and it would never run that way
Try replacing "!#bi/ksh" with "#!/bin/ksh"
then you could do something like listed below should give what you are looking for

ps -elf|grep xx.ksh|grep -v grep
# 4  
Old 01-29-2009
If you're running these scripts, the shell itself can give you the PID in the special variable ${!}.

Code:
# Run sleep, put it in the background
sleep 10 &
echo "PID of sleep is ${!}"
# Wait for sleep to finish
wait ${!}

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question