Register
It is currently Wed Nov 26, 2014 5:08 am

[Pipe] Read from stdin


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Jul 19, 2009 10:20 am   

Joined: Sun Jul 19, 2009 10:09 am
Posts: 1
Hi,

I'm writing a bash script to post data over network, with netcat command.

I would like my script work with pipe, well, I'm using:
Code:
while read data; do
   echo "$data" >> /tmp/paste_log
done


That rulz, but when the input data if finish, I would like ask to the user, a captcha system for bot prevention.

Code:
[... get data from server ...]
read -p "answer: " myanswer
[... output data with netcat ...]


The problem: "read" command is skipped when I use pipe, well "myanswer" is blank. 'Read' take the pipe as input data.
How can I read from stdin, after a pipe, without launch a second script ?

Thanks.
Sorry for my english. If you don't understand it, ask me :x


Top
 Profile  
 PostPosted: Sun Jul 19, 2009 9:16 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 569
see here


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP