Sponsored Content
Top Forums Shell Programming and Scripting Trouble with tee command to capture script outputs Post 302288232 by cfajohnson on Monday 16th of February 2009 06:52:02 PM
Old 02-16-2009
Quote:
Originally Posted by muthubharadwaj
In my context, the command which I run and pipe the output to using tee is a "shell function" defined within the script - not a script different from the one that calls it. Usually functions run in the same shell as the one in which the script calling them runs. Including pipe seems to make a difference ot the bahavior.

It doesn't matter whether it is a function or any other command; if it is in a pipeline, it is in a subshell.
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

What command or script to capture a system snapshot?

Some background on what I am trying to accomplish - Accreditation/Certification for DoD (Unix/Linux) system: I am trying to improve the process for capturing key system information in preparation for performing a formal security review of a Unix or Linux system. This is in addition to the SRR... (1 Reply)
Discussion started by: SecureMe
1 Replies

2. UNIX and Linux Applications

Tee with pipe command.

cat work.txt M|324324|32424|3431 M|324324|32424|3431 N|324324|32426|3432 N|324324|32424|3434 M|324324|32424|3435 cat work.txt | tee $( grep '^M' > m.txt ) | $( grep '^N' > n.txt ) cehpny00:/home01/sr38632 $ cat m.txt M|324324|32424|3431 M|324324|32424|3431 M|324324|32424|3435 ... (2 Replies)
Discussion started by: rsampathy
2 Replies

3. Shell Programming and Scripting

create outputs from other command outputs

hi friends, The code: i=1 while do filename=`/usr/bin/ls -l| awk '{ print $9}'` echo $filename>>summary.csv #Gives the name of the file stored at column 9 count=`wc -l $filename | awk '{print $1}'` echo $count>>summary.csv #Gives just the count of lines of file "filename" i=`expr... (1 Reply)
Discussion started by: rajsharma
1 Replies

4. Shell Programming and Scripting

tee + more command

script1: #!/bin/ksh more test.txt script2: calling the script1 #!/bin/ksh /tmp/script1.sh 2>&1 | tee tee.log where test.txt contains ~1200 lines. When I execute the script2 the more command does not print pagewise it goes to the end of the line, when I remove the tee command it... (4 Replies)
Discussion started by: prasad111
4 Replies

5. UNIX for Advanced & Expert Users

Equivalents of tee command to find exit status of command

Hi, Want to log the output of command & check the exit status to find whether it succeeded or failed. > ls abc ls: abc: No such file or directory > echo $? 1 > ls abc 2>&1 | tee log ls: abc: No such file or directory > echo $? 0 Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

6. Shell Programming and Scripting

Capture IP and command type in linux script

hi guys, is there any way to capture the ip address of users who log-in to linux then capture the command executed together with the time and date? example output 192.1.1.1 : ls -ltr Aug 6 16:38:40thanks in advance. (2 Replies)
Discussion started by: d3xt3r
2 Replies

7. UNIX for Dummies Questions & Answers

Problem using tee to capture activity - nothing happens

Hi, I'm sure this is real simple but in the looking I've done I haven't seen it addressed (or didn't realize it). I've started up a PuTTY connection to our UNIX box and started screen and script - no problems. Then I typed "tee teeKH18.txt" expecting it to start tee and dump all activity into... (2 Replies)
Discussion started by: Mike Welch
2 Replies

8. Shell Programming and Scripting

Help with tee command

In the current directory , I have seven files . But when I use the following command , it lists eight files ( 7 files + file_list.xtx) ls -1 | tee file_list.xtx | while read line; do echo $line ; done Does the tee command create the file_list.xtx file first and then executes the ls -1... (1 Reply)
Discussion started by: kumarjt
1 Replies

9. Shell Programming and Scripting

Question about tee command

I have the following script as shown below where I cat a file and then also tee the output to a file as I have to email the execution of the process to users at the end of the script: cat incoming.dat | tee -a execution.log if then echo "Issue with incoming.dat file, file not... (5 Replies)
Discussion started by: calredd
5 Replies

10. Shell Programming and Scripting

Need command to capture word from shell script and send email

Hello Experts, Greeting to all of you. I have a requirement, that we have a shell script status.sh that check the status of server and server status shows as status.sh Enterprise Server - Running Admin Server - Shutdown Requirement is like whenever the output shows shutdown it should... (2 Replies)
Discussion started by: aks_1902
2 Replies
FILTERM(1)							Linux User's Manual							FILTERM(1)

NAME
filterm - filter terminal input and/or output SYNOPSIS
filterm INPUT OUTPUT [COMMAND [ARGS]] DESCRIPTION
Execute the specified COMMAND (default is the shell), filtering terminal input and/or output. It can help e.g. when our terminal is unable to display non-ASCII characters or to enter them from the keyboard. It also makes writing var- ious terminal filters easier. INPUT and OUTPUT are names of konwert's filters - they are passed as the first argument to the konwert(1) program. filterm - OUTPUT fil- ters only output, and filterm INPUT - only input. The command - executes the shell as a login shell. It differs from konwert INPUT | COMMAND | konwert OUTPUT in that the command is executed on a pseudo-terminal, so full-screen programs work correctly. The filters have to output the characters as soon as they receive all necessary input, without buffering. trs(1) scripts are OK, but sed(1) or awk(1) or tr(1) scripts are not. In C you may use read(), getchar(), fread(), and write(), but putchar() and fwrite() only together with fflush(stdout). In C++: cin.get(), cout.put(), and cout <<. In perl: sysread, getc, read, and syswrite, but print only with $| = 1. The input filter will have set the environment variable FILTERM=in, and the output one - FILTERM=out. This way some filters can slightly alter their behaviour when working for filterm. OPTIONS --help display help and exit --version output version information and exit FILTERS FOR FILTERM
See konwert(1). Additionally the following konwert's filters are designed only for filterm: tyldy (input) Polish ~a~c~e~l~n~o~s~x~z lewyap (input) Polish `a`c`e`l`n`o`s`x`z boldpl (output) ASCII with Polish letters shown as bold. pinectrlchars (output) Replaces the characters 128..159 shown by the Pine (or another program) as ^A..^B back to the real 128..159. 512bold (output) Changes the mapping of colors in 512-character mode, which restricts the number of colors to eight. The palette is dynamically changed to contain the eight most recently used colors. When more colors are used at once, some of them display incorrectly. 512bold1 (output) Changes the mapping of colors in 512-character mode. Instead of ignoring the intensity, the following colors are available: black, red, green, white, blue, light magenta, light cyan, light gray; others are substitutied with approximations. This gives better effect, allowing to show the intensity, with the side-effect of belying the hue of some colors. kbdmacros (input) Keyboard macros. A sequence of keys can be recorded with Esc Ctrl-A SEQUENCE Esc Ctrl-E SHORTCUT - after which, if you press the SHORTCUT, the SEQUENCE will be generated instead. Later such assignment can be deleted with Esc Ctrl-A Esc Ctrl-E SHORTCUT Esc Ctrl- E. Instead of Esc Ctrl- you often may press Ctrl-Alt-. The defined shortcuts, together with the above redefinable key combinations used to define them, are stored in the ~/.kbdmacros file. Note: when you redefine a sequence, all its prefixes will not be passed through immediately, but wait until it can be unambiguously told which sequence was actually input. This includes escape sequences representing some extended keys. SEE ALSO
konwert(1) BUGS
512bold filter is not perfect. Some escape sequences may be emulated incorrectly. Additionally, colors changed in multiple steps or not used unnecessarily allocate some of the eight colors. COPYRIGHT
filterm filters terminal input and/or output. It forms part of the konwert package. Copyright (c) 1998 Marcin 'Qrczak' Kowalczyk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA AUTHOR
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.home.ml.org/ \__/ GCS/M d- s+:-- a21 C+++>+++$ UL++>++++$ P+++ L++>++++$ E->++ ^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP->+ t QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y- Konwert 30 Jul 1998 FILTERM(1)
All times are GMT -4. The time now is 05:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy