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.

ps -e |grep $1

This will grep $1 from ps -e output....

If you are trying to find the output as PID and the corresponding process then try following....

ps -e|awk '{print $1 " " $4}'

HTH

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

are you looking for a script like below?

echo " Enter the PID: "
read a
ps -ef |grep $a

A script to display details on the process given as first argument + it's children:

ps -fT $1