Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ECHO PID 2

Status
Not open for further replies.

TC2000

Programmer
Dec 28, 2000
32
HK
I try to setup a script which will include over 10 sql command.
For each sql command, it will run in the backend.
e.g. nohup sqlplus uid/pid @fdfdfdfdf &
I will like to echo the Process ID.
Can anyone tell me how???
 
Not entirely sure what you mean ... you can get the PID of the current shell using $$.

Greg.
 
In ksh and sh, the last process id put into background is stored in the environmental variable: $!

In csh, I don't believe that's available except through
some heroic grepping of the ps command.

ps -deaf | fgrep $$ | etc....
 
If you just want the the PID's of the sqlplus processes, you could do something like this:

ps -ef | grep sqlplus | grep -v grep | awk '{print $2}'

This will just display the PID's of the sqlplus processes.
 
Or
Code:
 ps -ef | grep [s]qlplus | awk '{print $2}'
for reasons explained nicely in thread822-306375 CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top