![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to store values into variable in perl | chittiprasad15 | Linux | 3 | 05-07-2008 09:21 PM |
| How to Store command O/P to a variable... | smartbuddy | UNIX for Dummies Questions & Answers | 7 | 08-24-2007 04:49 AM |
| To store the output in a variable | Sudhakar333 | Shell Programming and Scripting | 2 | 07-10-2007 05:45 AM |
| store awk results in a variable | forever_49ers | Shell Programming and Scripting | 1 | 09-19-2006 07:51 PM |
| When can a script deny to store any value in a variable | mitte_dino | Shell Programming and Scripting | 1 | 10-04-2005 03:57 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
|||
|
|||
|
Quote:
Here the million and first way (it really depends on your version of ps or Unix) On Linux and Solaris we have pgrep Code:
pid=$(pgrep name_of_cmd) Code:
pid=$(UNIX95= ps -C name_of_cmd -o pid=) Testing if pid holds valid content is also heavily dependent on the used shell. In a posix shell we could do (if we were process owner or root, or omit the kill) Code:
[[ -n $pid ]] && kill -0 $pid && echo "is alive" |
|||
| Google The UNIX and Linux Forums |
| Forum Sponsor | ||
|
|