Redirecting standard error issues.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Redirecting standard error issues.
# 1  
Old 06-21-2010
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:

Code:
[tibco@auktltar DailyCheckScript]$ ./CheckVSSLocks.sh
----------------------------------------------------------------
*************************VSS2 Locks*****************************
----------------------------------------------------------------
Domain                     Status
The Vss2 log files are not found for ICCIR2Test01
The Vss2 log files are not found for ICCIR2Test02
The Vss2 log files are not found for ICCIR2Test04
The Vss2 log files are not found for ICCIR2Test06
The Vss2 log files are not found for ICCIR2Test07
The Vss2 log files are not found for ICCIR2Test08
The Vss2 log files are not found for ICCIR2Test09
The Vss2 log files are not found for ICCIR2Test10
The Vss2 log files are not found for ICCIR2Test11
The Vss2 log files are not found for ICCIR2Test12
The Vss2 log files are not found for ICCIR2Test13
The Vss2 log files are not found for ICCIR2TEST14
The Vss2 log files are not found for ICCIR2Test15
The Vss2 log files are not found for ICCIR2TEST16
The Vss2 log files are not found for ICCIR2Tiest15
The Vss2 log files are not found for ICCIRSTDEV03
cat: Vss2logs.txt: No such file or directory
rm: cannot remove `Vss2log*': No such file or directory

Here is the output with redirection:
Code:
[tibco@auktltar DailyCheckScript]$ ./CheckVSSLocks.sh 2>&1 >/dev/null
cat: Vss2logs.txt: No such file or directory
rm: cannot remove `Vss2log*': No such file or directory

Can you please let me know what exactly is the issue and how it can be sorted out?

Thanks,
Chandan Singh
# 2  
Old 06-21-2010
i think its working. its showing.. u what is the error.
# 3  
Old 06-21-2010
Hi,

Thanks for your prompt response.

Is it possible to redirect it? I am going to add this script to the crontab.

So, bit worrying if it causes any problem during its schedule execution.
# 4  
Old 06-21-2010
Code:
./CheckVSSLocks.sh 2> /dev/null > &1

i think this is what u were asking.. check this.
# 5  
Old 06-21-2010
Code:
cat yourfile 1> somefile 2> /dev/null


Last edited by Scott; 06-21-2010 at 07:20 AM.. Reason: Code tags
# 6  
Old 06-21-2010
if the above command works for u then u dnt have to worry about .. putting it in crontab. u can put in cron widut worrying.
# 7  
Old 06-21-2010
Sorry, no luck.

Now it is giving me syntax error. I am using Linux .

Code:
[tibco@auktltar DailyCheckScript]$ ./CheckVSSLocks.sh 2 >/dev/null > &1
-bash: syntax error near unexpected token `&'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

2. 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

3. 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

4. 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

5. Shell Programming and Scripting

standard error to standard out question

Hi there how can i get the result of a command to not give me its error. For example, on certain systems the 'zfs' command below is not available, but this is fine becaues I am testing against $? so i dont want to see the message " command not found" Ive tried outputting to /dev/null 2>&1 to no... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

6. Shell Programming and Scripting

redirecting std error

Hi, I use the following command make all > output-`date +%F-%H-%M-%S`.txt 2>&1 to invoke a MAKE process that takes some weeks to complete. The ouput is redirected to a text file. Now I prefix the above command with time to get time needed for completion of the MAKE process time make... (2 Replies)
Discussion started by: gkamendje
2 Replies

7. UNIX for Advanced & Expert Users

Redirecting to Error File

Hi- I want to redirect the output of the echo to the standard error file. We require this because, when we try to scp a file from a source server to a target server we get an error code 1. Later we found that it was due to the .cshrc file which outputs on stdout which is making the scp to fail.... (1 Reply)
Discussion started by: lorcan
1 Replies

8. 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

9. Shell Programming and Scripting

Redirecting to standard output from within called script

Hi, How to achieve this? Let us assume the following: There are 2 scripts a.ksh and b.ksh $ cat a.ksh sh b.sh 2>&1 >> /work/log/a_log.txt $ cat b.sh echo "abcd" My requirement is, is there a way to display this abcd in standard output also alongside of writing into a_log.txt?... (8 Replies)
Discussion started by: vigneshra
8 Replies

10. UNIX for Dummies Questions & Answers

Error: Internal system error: Unable to initialize standard output file

Hey guys, need some help. Running AIX Version 5.2 and one of our cron jobs is writing errors to a log file. Any ideas on the following error message. Error: Internal system error: Unable to initialize standard output file I'm guessing more info might be needed, so let me know. Thanks (2 Replies)
Discussion started by: firkus
2 Replies
Login or Register to Ask a Question