LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-22-2014, 08:20 AM   #1
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
should there be another input/output stream (3:stdinfo)


should there be another text stream for the terminal.

i propose 3:stdinfo where stuff isnt an error or warning that would get redirected to 2:stderr but informational stuff like wget server information or mysql fetch information about how many rows pulled and how long it took ?

output from the time command would be another example.

Last edited by schneidz; 05-22-2014 at 08:49 AM.
 
Old 05-22-2014, 10:21 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,125

Rep: Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260
How is that different from stdout?
 
Old 05-22-2014, 10:26 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
stdout is info i care about. stdinfo would be info that is not essential but good to know. e.g.:
Code:
[schneidz@hyper ~]$ wget www.02144.com > std.info 
--2014-05-22 11:32:17--  http://www.02144.com/
Resolving www.02144.com... 64.235.229.141
Connecting to www.02144.com|64.235.229.141|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 421 [text/html]
Saving to: “index.html”

100%[==============================================================================================>] 421         --.-K/s   in 0s      

2014-05-22 11:32:18 (12.1 MB/s) - “index.html” saved [421/421]

[schneidz@hyper ~]$ cat std.info # empty
[schneidz@hyper ~]$ cat index.html 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>West Somerville, baby.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="02144.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="50%" border="0" cellspacing="10" cellpadding="0">
  <tr>
    <td><span class="headertext">02144.com</span></td>
  </tr>
</table>
</body>
</html>
[schneidz@hyper ~]$
note that the wget information wasnt redirected to the file because it was in the stderr stream (eventhough technically the command did not error).

what i am proposing would be this would be used for error details:
wget http://www.this-site-doesnt-exist.com 2> error.out

and this would be for informative details that arent vital such as resolved ip-addresses/bits per second/...:
wget http://www.linuxquestions.org 3> info.out

and like normal this would be for normal program output:
wget -q -O - www.02144.com 1> std.out

Last edited by schneidz; 05-22-2014 at 10:43 AM. Reason: wget is a better example than time
 
Old 05-22-2014, 11:21 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,684

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
you can easily implement such feature in your environment. But I do not have any idea if it was really useful. See syslogd, it has much better capabilities...
 
Old 05-22-2014, 11:53 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
I'd like that. Many programs are built to send their output to stdout, which means you can't send informative messages into stdout or it will be mixed with the actual program output. [in my opinion] you shouldn't dump informative messages into stderr either, or it will look like error.

There are many cases in which the program I'm trying to run dumps its output on stdout. I need the output uncorrupted, and I want to see any errors as well, but I don't want to clutter it up with random informative messages.

Some programs have a -q flag to shut off informative messages while retaining error messages, but the implementation is inconsistent. Sometimes -q shuts off error messages as well, sometimes there is no -q flag and you either get stdout or stderr loaded up with information you often don't care about. If this is running in a cron job, this forces you to either get an email every time the job runs which is filled with random informative messages, or you have to redirect stderr to a file or /dev/null and risk not being notified at all in the event of an actual error. You could check the exit status, but then you don't have the message to go along with it. Before too long a little 1-line cron job turns into a 20 line script with exit status checking, stderr file parsing, email, etc.

As with most other things in the computing world, there are ways around the problem, but I do think the cleaner and better solution is a third stream for information like this.

Last edited by suicidaleggroll; 05-22-2014 at 11:55 AM.
 
1 members found this post helpful.
Old 05-22-2014, 01:59 PM   #6
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,125

Rep: Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260
wget already has a way to do this. "-o" puts the log messages to a file. You can also use "-d" "-v" "-nv" and "-q" to turn up or down the amount of messages. I think these types of options are common.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Tar utility to untar(extract) from a continuous input stream sajalmalhotra Linux - General 4 01-29-2014 02:12 AM
[SOLVED] how display part of an output stream joveniel Linux - Newbie 4 02-10-2011 01:03 AM
How to stream ? (TV card input) a.dehqan Linux - Software 0 01-04-2009 07:04 AM
Dynamic Input Stream control lucky6969b Programming 1 01-13-2006 12:55 AM
mplayer to output stream eantoranz Linux - Software 0 05-17-2004 02:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:24 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
Open Source Consulting | Domain Registration