![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem executing a script | mr_manii | Shell Programming and Scripting | 5 | 10-06-2009 04:08 AM |
| Executing a shell script from windows;script present in unix | rajneesh_kapoor | UNIX for Advanced & Expert Users | 4 | 05-08-2009 02:54 PM |
| Problem executing script through at | viktor4124 | Shell Programming and Scripting | 2 | 04-06-2009 01:56 PM |
| Problem with executing script using ssh | maethlin | Shell Programming and Scripting | 4 | 08-14-2008 02:46 PM |
| Problem executing a script | hemangjani | Shell Programming and Scripting | 4 | 02-12-2008 02:21 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Having problem with executing shell script to get the pid details!
Hello Everyone,
I am new to shell scripting and also i am very new to AIX machine I have a question. I have shell script which contains the follwing "ps -e |grep $1 echo $2" i run this schell script by doing this ./startSehllscript 3444 passed with two parameters . Accroiding my assumption i though it will print the pid details with the parameter 2. but when i run this script it could return me back kust a single string "passed" I wanted to get the process deatils. If i run this "ps -e |grep $1" in the UNIX shell it runs fine and gives me back the pid details but when i do it by the shell script it deos not return me back the pid details. How can we write the commadn ina such a way that it will return me back the pid details. I would really appreciate if some one can answer my question. Thanks, Swati |
|
||||
|
Hello,
What exactly you are trying to do? your question doesnt have any goal/scenario. Code:
ps -e |grep $1 If you are trying to find the output as PID and the corresponding process then try following.... Code:
ps -e|awk '{print $1 " " $4}'
|
|
||||
|
Rephrasing my question...
Hello,
Sorry for the inconvenience...I am rephrasing my question. My main goal is to execute a shell script which will take "pid" as a parameter and the shell script should print the details of the "pid". For this purpose i have created a shell script with the following content.. "ps -e |grep $1 echo $2" When i execute the script with the parameter pid with some other parameter it does not print the pid ....... Hope it is bit clear to you.... Thanks, Swati |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|