LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-10-2006, 02:55 PM   #1
elmafiacs
LQ Newbie
 
Registered: Apr 2004
Posts: 27

Rep: Reputation: 15
Redirecting sh output to a pipe


I want to redirect the output of a 'sh' shell to a socket, from a C program. I have a big problem: nothing appears!. I mean, when I redirect the output of, for example, a 'ls' command, it works just fine; but when I try it with 'sh' it doesn't.

I thought this was because 'sh' also opens STDIN at start, and that may be screwing pipes up. So I closed them ( close(0); ), but it still didn't work.

Can someone point out why I can get things right?

Last edited by elmafiacs; 05-10-2006 at 03:03 PM.
 
  


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
Redirecting output from XEV 3saul Linux - Software 1 02-26-2006 02:14 PM
Redirecting output into a filename pbickerd Linux - Software 10 02-24-2006 03:41 PM
Redirecting mplayer output driptray Linux - Software 1 10-12-2004 08:42 AM
redirecting output in Bourne shell trutnev Linux - Software 2 04-22-2004 04:55 AM
redirecting xmms output durden2.0 Linux - Software 0 03-06-2004 08:29 PM


All times are GMT -5. The time now is 07:30 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration