The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing global variable to a function which is called by another function sars Shell Programming and Scripting 4 06-30-2008 11:39 AM
Replace a Pipe with tab srikanthus2002 Shell Programming and Scripting 1 04-25-2007 06:22 AM
Function within function (Recurance) chassis UNIX for Dummies Questions & Answers 2 09-19-2006 09:32 AM
PIpe Spy jodders High Level Programming 11 02-18-2004 10:44 AM
pipe help bb666 High Level Programming 5 02-26-2002 04:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-31-2007
Orbix Orbix is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 34
function and pipe

Hi,

Is it possible that the output of a command is piped into a unix function? Just like in below:
Code:
#!/bin/ksh
concat(){
echo Orbix
}
echo "Hello there" | concat
Quote:
Output should be:
Hello there Orbix
How to manipulate the output of a command inside the function?
  #2 (permalink)  
Old 01-01-2008
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Code:
#!/bin/ksh
concat(){
cat
echo Orbix
}
echo "Hello there" | concat
or

Code:
#!/bin/ksh
concat(){
read N
echo "$N" Orbix
}
echo "Hello there" | concat
  #3 (permalink)  
Old 01-01-2008
Orbix Orbix is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 34
Great! Cool. Why did I not think of using read inside the function? Hehehe. Thanks for the reply
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0