Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Output of until to file versus stdout Post 303032331 by stomp on Friday 15th of March 2019 09:51:21 AM
Old 03-15-2019
Quote:
Originally Posted by Xubuntu56
Why does this until false; do history | head -5; done
result in a stdout infinite loop, yet until false; do history | head -5 > hist5; done
only writes it once to file hist5? Furthermore, I can hear the hard drive working on the 2nd command until I end the process, but the history | head -5 is only written once.

It does not write once. It writes continously without break the same 5 lines into hist5 file over and over and generates considerable load at your machine. Since every session has its own history this makes no sense to do.


I'm unsure, but I assume .bash_history file is written at logout. If you want to see another sessions history with this, this will not work.
This User Gave Thanks to stomp For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

CTRL+H versus ^? versus BACKSPACE

Hi Gurus! I recently got my shell account (HP UX v11) created by our sysadmin and am having problem deleting with the backspace key. After doing some reading, I believe I need to enter a custom "STTY..." statement in my profile. Can someone please help me with the correct "STTY" sequence... (3 Replies)
Discussion started by: alan
3 Replies

2. UNIX for Advanced & Expert Users

sending syslog output to stderr or stdout

Is there a way to send the syslog output for a given facility to stderr or stdout? I do not want to use the "tail" command to achieve this, I would like it to go directly to stderr. Thanks in advance (1 Reply)
Discussion started by: dmirza
1 Replies

3. Shell Programming and Scripting

Script Output Woes (stdout?)

Hey everyone. I have been trying a few filtering scripts with both SED and PERL. So far I have both of these versions working to reformat the incoming text stream (from stdin) into the corrent format (it looks good in the terminal), but I don't think that I am doing it right because the... (2 Replies)
Discussion started by: c0nn0r
2 Replies

4. Shell Programming and Scripting

Dual output (stdout and file)

Hello everybody, Is there a more elegant way to make dual output (display on standard output and append to a file) while I'm executing a shell script, besides duplicating the echo command for every string? echo "Message..." > 1 echo "Message..." >> myfile.out Thank you for your time,... (2 Replies)
Discussion started by: AdrianM
2 Replies

5. Shell Programming and Scripting

let curl output to stdout AND save to a file

hello hackers. i have a curl process running as cgi directly pushing stdout to the client. but i want to additionally save that stream to a file at the same time. any directions madly welcome. thanks in advance (3 Replies)
Discussion started by: scarfake
3 Replies

6. Shell Programming and Scripting

Creating an Array in KSH from output (stdout)

Using Cygwin PDksh - But also have tested it on Linux with same results ---- I have a script that invokes a program/script and returns a string of data (1234 "12 34 56" 6789) and using "set -A" inserting it into an array. script code snipit >> get_array=$(php... (2 Replies)
Discussion started by: carlos25
2 Replies

7. Shell Programming and Scripting

Redirecting part of output to stdout

Hi, I am trying to execute a command like this: find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the... (2 Replies)
Discussion started by: Legend986
2 Replies

8. Programming

Print C file output both in stdout and file

Hello! I want to post a question. does anybody know how to print the output of a C program both in stdout and a file?? thanx (8 Replies)
Discussion started by: nicos
8 Replies

9. Red Hat

CPU usage: PS versus TOP - Different output

CPU usage: PS versus TOP - Different output Hi When monitoring a Linux environment with PS command, reported CPU value for a certain process differs, sometimes greatly, from the value seen in TOP. I understood this is not a bug, they report different data. I can't understand the nature... (4 Replies)
Discussion started by: liav
4 Replies

10. Shell Programming and Scripting

File descriptors, redirecting output, and stdout

Hello all. I've been lurking here for a year or two and finally decided to post. I need some assistance with file descriptors, stdout, and redirecting output. I've searched through a number of very helpful threads here (unfortunately I can't link to any of them yet due to my low post count...),... (2 Replies)
Discussion started by: Michael_K
2 Replies
M2TS2TS:(1)							   User Commands						       M2TS2TS:(1)

NAME
m2ts2ts - Convert m2ts to TS SYNOPSIS
m2ts2ts [switches] <infile> <outfile> DESCRIPTION
TS tools version 1.11, m2ts2ts built Nov 11 2008 17:15:50 Files: <infile> is a BDAV MPEG-2 Transport Stream file (M2TS) (but see -stdin) <outfile> is an H.222 Transport Stream file (but see -stdout) General Switches: -stdin Input from standard input instead of a file -stdout Output to standard output instead of a file -verbose, -v Output informational/diagnostic messages -quiet, -q Only output error messages -buffer <n>, -b <n> Number of TS packets to buffer for reordering Defaults to 4. TS tools version 1.11, m2ts2ts built Nov 11 2008 17:15:50 Files: <infile> is a BDAV MPEG-2 Transport Stream file (M2TS) (but see -stdin) <outfile> is an H.222 Transport Stream file (but see -stdout) General Switches: -stdin Input from standard input instead of a file -stdout Output to standard output instead of a file -verbose, -v Output informational/diagnostic messages -quiet, -q Only output error messages -buffer <n>, -b <n> Number of TS packets to buffer for reordering Defaults to 4. SEE ALSO
The full documentation for m2ts2ts is maintained as a Texinfo manual. Please check http://tstools.berlios.de for more information. m2ts2ts 1.11 November 2008 M2TS2TS:(1)
All times are GMT -4. The time now is 10:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy