LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-15-2009, 10:14 AM   #1
casperdaghost
Member
 
Registered: Aug 2009
Posts: 349

Rep: Reputation: 16
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.
 
Old 08-15-2009, 10:25 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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
 
Old 08-15-2009, 11:28 AM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Maybe:
Code:
$ ls -ltr $((pidofprocess + 73000))
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script pipe input - bash mostly laikos Programming 4 11-09-2008 06:14 PM
How can I pipe output of a command into arguments of a script HGeneAnthony Linux - General 3 12-26-2007 07:24 AM
command with shell script sunlinux Programming 2 12-29-2006 12:36 AM
Command in shell script Grassie Coetzee Linux - Software 1 03-13-2005 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration