-   Linux - Newbie (
-   -   shell script - pipe command (

casperdaghost 08-15-2009 10:14 AM

shell script - pipe command
i need to write a script.

we add a static number to the pid of the process which gives us a communication id which the process uses to talk to other processes

we add 73000 to the LINUX PID which gives us the COMMUNICATION ID.

so i need to write some thing like this

echo pidofprocess 73000 | awk { print $1 + $2 } = $variable | ls -ltr $variable

i need to understand how to create substitution values in awk and then transfer them to a linux command.

i do it a hundred times a day running the awk command , then cutting and pasting the result in to the ls -ltr command on the host.

it is time to automate.

GrapefruiTgirl 08-15-2009 10:25 AM


bash-3.1$ a=65
bash-3.1$ b=73000
bash-3.1$ let c=a+b
bash-3.1$ echo $c

or did you want them as appended strings?

bash-3.1$ c=$a$b
bash-3.1$ echo $c

Maybe (as someone else said elsewhere) I'm over-simplifying this, or you're over-complicating it :) but if I've missed the point, please correct me.


ilikejam 08-15-2009 11:28 AM


$ ls -ltr $((pidofprocess + 73000))

All times are GMT -5. The time now is 12:41 AM.