LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell script - pipe command (https://www.linuxquestions.org/questions/linux-newbie-8/shell-script-pipe-command-747753/)

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

Code:

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

or did you want them as appended strings?
Code:

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

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.

Sasha

ilikejam 08-15-2009 11:28 AM

Maybe:
Code:

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


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