Bash - proper way to append variable to stderr


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash - proper way to append variable to stderr
# 8  
Old 09-18-2017
I think the question was about post-processing stderr.
This is not trivial.
The command 2> >( post-command > error.log ) is one method.
There is also the classic { command 2>&1 >&3 | post-command > error.log; } 3>&1 method.
This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirect string from bash stderr to user stdin

Hi there, I need to execute a command in the bash. The program prints some standard (output and) error and then wants the user to choose one of several options and type the according input. I am trying to solve this issue in a bash script but also running into some circular dependency. How can I... (7 Replies)
Discussion started by: fredestet
7 Replies

2. Shell Programming and Scripting

Proper distribution of cards in terminal based crazy8's game in bash script

When I run the following script at the bottom it say cards remaining=44...It should be=35. Can anyone tell me what I'm doing wrong. I've spent hours trying to get this to work and I can't go any further until this part works. thank you in advance Cogiz #!/bin/bash # Date="November, 2016" #... (2 Replies)
Discussion started by: cogiz
2 Replies

3. Shell Programming and Scripting

[bash] how is proper way to validate user input

hi all, i have a script that need user input provide all variables that needed to complete a job. this is my current script: echo "type file source and it full path :" read INPUTFILE if || ; then echo "ERROR: you didn't enter a file source or file source is not... (2 Replies)
Discussion started by: makan
2 Replies

4. Shell Programming and Scripting

How to redirect the STDERR to a variable in perl?

in my perl script i tried the below statement $result = `cleartool rmstream -f $s1 1> /dev/null`; so as to redirect then error messages,when i print the $result ,it seems to be Null. (4 Replies)
Discussion started by: ram_unx
4 Replies

5. Shell Programming and Scripting

ssh, bash, and /dev/stderr: no such device

Hello, When I run the following program: ssh 192.168.1.4 bash -l <<EOF > echo foo >/dev/stderr > EOF I get the following confusing error. bash: line 1: /dev/stderr: No such device or address Does anyone know why and how to fix it? I'm capturing stdout in a variable, but I... (2 Replies)
Discussion started by: brsett
2 Replies

6. Shell Programming and Scripting

Append stderr

Hi everybody. I was used to redirect stderr to a file in this way, calling a generic script:./myScript &> output.logBut now I need something more sophisticated...Inside a bash script I launch an executable in this way:${command} >> "${globalLogFile}"So I redirect the stdout into globalLogFile.... (14 Replies)
Discussion started by: canduc17
14 Replies

7. Shell Programming and Scripting

Can STDERR be saved to a variable

Guys i'm trying to save STDERR to a variable for a portion of my ksh script on solaris. I know i can create redirects to files as such: exec 4>/tmp/lava print "This will be saved to /tmp/lava and not screen"; >&4 print "This will be seen on screen" >&2 I want to save the STDOUT of a... (4 Replies)
Discussion started by: lavascript
4 Replies

8. Shell Programming and Scripting

Redirecting STDERR to a file from within a bash script

I am trying to redirect the output from stderr to a log file from within a bash script. the script is to long to add 2> $logfile to the end of each command. I have been trying to do it with the command exec 2> $logfile This mostly works. Unfortunately, when a read command requires that anything be... (5 Replies)
Discussion started by: vockleya
5 Replies

9. Shell Programming and Scripting

can't redirect stderr in bash

Consider: #!/bin/sh #this is a shell script in sh (bourne) grep missingfile 2>errout.txt It works from the command line, but keeps producing errors from the script. So how do I redirect in a bash shell...or bourne? (3 Replies)
Discussion started by: lumix
3 Replies

10. Shell Programming and Scripting

redirect stderr to dev/null in bash env.

Working in a bash environment, in the following example, how do I direct the error message that putting in an invalid flag (-j for example) would normally produce to dev/null? while getopts "abcd" opt do case "$opt" in i) a etc ;; r) b etc ;; f) c etc ;; v) d... (7 Replies)
Discussion started by: Sniper Pixie
7 Replies
Login or Register to Ask a Question
PMDATRIVIAL(1)						      General Commands Manual						    PMDATRIVIAL(1)

NAME
pmdatrivial - trivial performance metrics domain agent (PMDA) SYNOPSIS
$PCP_PMDAS_DIR/trivial/pmdatrivial [-d domain] [-l logfile] [-U username] DESCRIPTION
pmdatrivial is the simplest possible Performance Metrics Domain Agent (PMDA) which exports a single performance metric, the time in seconds since the 1st of January, 1970. The trivial PMDA is shipped as source code and is designed to be an aid for PMDA developers. A brief description of the pmdatrivial command line options follows: -d It is absolutely crucial that the performance metrics domain number specified here is unique and consistent. That is, domain should be different for every PMDA on the one host, and the same domain number should be used for the same PMDA on all hosts. -l Location of the log file. By default, a log file named trivial.log is written in the current directory of pmcd(1) when pmdatrivial is started, i.e. $PCP_LOG_DIR/pmcd. If the log file cannot be created or is not writable, output is written to the standard error instead. -U User account under which to run the agent. The default is the unprivileged "pcp" account in current versions of PCP, but in older versions the superuser account ("root") was used by default. INSTALLATION
If you want access to the names, help text and values for the trivial performance metrics, do the following as root: # cd $PCP_PMDAS_DIR/trivial # ./Install If you want to undo the installation, do the following as root: # cd $PCP_PMDAS_DIR/trivial # ./Remove pmdatrivial is launched by pmcd(1) and should never be executed directly. The Install and Remove scripts notify pmcd(1) when the agent is installed or removed. FILES
$PCP_PMCDCONF_PATH command line options used to launch pmdatrivial $PCP_PMDAS_DIR/trivial/help default help text file for the trivial metrics $PCP_PMDAS_DIR/trivial/Install installation script for the pmdatrivial agent $PCP_PMDAS_DIR/trivial/Remove undo installation script for the pmdatrivial agent $PCP_LOG_DIR/pmcd/trivial.log default log file for error messages and other information from pmdatrivial PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
PCPIntro(1), pmcd(1), pmdasample(1), pmdasimple(1), pmdatxmon(1) and PMDA(3). Performance Co-Pilot PCP PMDATRIVIAL(1)