Sponsored Content
Top Forums Shell Programming and Scripting standard error to standard out question Post 302318778 by hcclnoodles on Friday 22nd of May 2009 08:31:19 AM
Old 05-22-2009
Quote:
Originally Posted by pludi
You're setting up redirection for that command, while the message is sent by the shell. You can either redirect that too by using exec, or you can do it the smart way:
Code:
if [ -x /path/to/zfs ]
then
    zfs list | grep ...
    ...
else
    # Whatever to be done if zfs isn't there
fi

By the way, grep knows the -q switch, which only sets $? based on whether the term is found or not, and produces no additional output.


Ok thanks, if I were to put that 'if' statement in there it would mean a bit of a change to the script so im particularly interested in the 'exec' method you mention.... ive tried

Code:
# exec zfs list | grep $HOME$ > /dev/null 2>&1
bash: exec: zfs: not found

but as you can see i still get the message, is this what you mean ??
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Writing to Standard Error

Hi. I'm working on a project for a class, and there's one part of the project that is confusing me. It's a compression and decompression project, and after we write our code for compression, we need to write to standard error. (1) Size of original file (number of characters read... (1 Reply)
Discussion started by: sjung10
1 Replies

2. UNIX for Dummies Questions & Answers

Question from a newbie. How to redirect standard output

I have a program that is sending error text to the console and I need to redirect that output to a log file. I'm brand new to Unix and don't know how to do this. Any direction would be greatly appreciated. (1 Reply)
Discussion started by: ndemos
1 Replies

3. Shell Programming and Scripting

redirect only the standard error output to mail

I'm writing a script using file descriptor 2 (std error) to send an email only if the command fails or errors out but the script always emails me irrepective of whether it fails or not. It will not email the /tmp/check.error file output if doesn't error out just the mail with the subject "Cannot... (3 Replies)
Discussion started by: barkath
3 Replies

4. Shell Programming and Scripting

[BASH] redirect standard error and use it inside

Hi all, Maybe my question is too simple but till now i couldn't figure about a solution :( I have a bash script scheduled in cron: <cron time parameters> my_script.sh > result.log 2>&1 By this way i can have standard output and standard error in my result.log file Now i want my script... (2 Replies)
Discussion started by: Pescator
2 Replies

5. Shell Programming and Scripting

Redirect standard error to input of other process, 2| ?

Hello, I would like to know if there is a shell in which operations such as 2| (redirect standard error of one process to the standard input of another one) exist? I know it is possible to do it in bash with things like: (process 2>&1) | other_process but I find it a bit intricate when... (3 Replies)
Discussion started by: chlorine
3 Replies

6. Shell Programming and Scripting

Writing to standard error

Hi, I want to redirect the standard output to standard error whenever an error occurs for ex if then echo right else echo wrong fi I want to redirect the wrong to stderror .Adding a line 1>&2 will do that or is additional code to be added.How can i verify whether the output... (2 Replies)
Discussion started by: padmisri
2 Replies

7. UNIX for Dummies Questions & Answers

Redirect Standard output and standard error into spreadsheet

Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway? Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies

8. Shell Programming and Scripting

Redirecting standard error issues.

Hello Friends, Good Day. I am trying to redirect a standard error to the bit bucket(/dev/null) but it is not working. Though, it is working fine in redirecting the standard output. Below is the output of my script without any redirection: $ ./CheckVSSLocks.sh... (16 Replies)
Discussion started by: singh.chandan18
16 Replies

9. Shell Programming and Scripting

Standard out and standard error

I need to run a cronjob and in the cronjob I execute a script that if there is an error produces standard error so I do /RUNMYSCRIPT 2> mylogfile.log However, if it runs correctly, I don't get a standard error output, I get a standard out output. How do I redirect both standard error and... (2 Replies)
Discussion started by: guessingo
2 Replies

10. Shell Programming and Scripting

Handling standard error in condition

Testing this with KSH on RHEL The bellow code works but i can't seem to handle the exit status of the unix command when it fails... i wanted to put something like >/dev/null 2>&1 to manage standard output and standard error but it changes my logic and the code doesn't work cause it doesn't... (11 Replies)
Discussion started by: maverick72
11 Replies
AMANDA-APPLICATIONS(7)						    Miscellanea 					    AMANDA-APPLICATIONS(7)

NAME
amanda-applications - Application-api for amanda DESCRIPTION
Describe how to use application with Amanda APPLICATIONS
This section lists the applications included with Amanda. See the individual man pages for instructions on using them. For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com. o amgtar(8), - use GNU Tar to backup and restore data. o ampgsql(8), - use PostgreSQL's continuous WAL archiving. o amraw(8), - use open and read to read the data. o amsamba(8), - use smbclient to backup and restore data. o amstar(8), - use star to backup and restore data. o amsuntar(8), - use native tar on Solaris to backup and restore data. o amzfs-sendrecv(8), - use zfs to create a snapshot and use 'zfs send' to generate the backup. o amzfs-snapshot(8), - use zfs to create a snapshot and for use with other applications (e.g. amgtar) DEFINING APPLICATIONS
An application is defined in amanda.conf(5) as follows: define application-tool $appconfigname { plugin "$pluginname" property "$PROPERTY_NAME" "$PROPERTY_VALUE" ... } and then referenced in a dumptype as define dumptype $dumptypename { ... program "APPLICATION" application "$appconfigname" } Application properties, like Amanda configuration parameters, are insensitive to case, and - (dash) and _ (underscore) may be used interchangeably. See the individual plugin documentation for properties applicable to each plugin. SEE ALSO
amanda(8), amanda.conf(5) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHORS
Jean-Louis Martineau <martineau@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Dustin J. Mitchell <dustin@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.1 02/21/2012 AMANDA-APPLICATIONS(7)
All times are GMT -4. The time now is 03:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy