How to redirect error message?


 
Thread Tools Search this Thread
Top Forums Programming How to redirect error message?
# 1  
Old 10-08-2004
How to redirect error message?

Hi,
I was trying to cat some files but not all of them exist.
I would get some messages like below:

cat: cannot open /mil2_usr1/time_logs/investigator/6334
cat: cannot open /mil3_usr1/time_logs/investigator/6334
cat: cannot open /mil3_usr1/time_logs/investigator/6352


I don't want to see them when I run my program.
Is there any way that I can redirect them somewhere else instead of the screen?

Thanks a lot!
# 2  
Old 10-19-2004
Data error redirect is not working

I tried to use 2>/dev/null, but it didn't work.

Do you know why?


milford1 52 -> cat 006 dkd 2>/dev/null
cat: cannot open 006
cat: cannot open dkd
cat: cannot open 2




By the way, I am using borne shell. I was trying to cancatnate some files into one big file and if no named file exists in the command to cat I don't want to see the error message.
THAX!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ambiguos Redirect Error

I have the below lines of code. ls found*.tmp | while IFS= read -r entry; do APP_NAME=$(sed -n -e 's/^.*<name>//' -e 's|</name>.*$||'p $entry | sed 's/\(<name>\|<\/name>\)//g') echo "APP_NAME="$APP_NAME>$APP_NAME"_Deploy.cfg" doneI m getting the below error while running the above script.... (4 Replies)
Discussion started by: mohtashims
4 Replies

2. Ubuntu

How redirect syslog message to a specified file?

Hello to everyone! I have a question about syslog. I want put the messages of log in a particular file but really i don't know how to do that or i don't get the results that I want. I do this: #include <stdio.h> #include <stdlib.h> #include <syslog.h> int main (void) { ... (4 Replies)
Discussion started by: Kovalevski
4 Replies

3. Shell Programming and Scripting

How to solve ambigious redirect error?

hi all, i had the below script filename = /osa/data1/output.txt printf '%27s%53s\n' ' CURRENT DATE' 26-08-2014 >> $filename iam getting the ambigiuos redirect error in the 2nd line of the code...please guide me regards, vasa saikumar (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

4. Linux

Ambiguous redirect error and syntax error when using on multiple files

Hi, I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help ); #!/bin/bash #... (16 Replies)
Discussion started by: Madhusudan Das
16 Replies

5. Shell Programming and Scripting

Redirect grep error/result to file

I'm having trouble piping grep results/error to a file. Why can't I redirect these messages into a file? $ grep -r -o "pattern" * > log Binary file foo1 matches Binary file foo2 matches Binary file foo3 matches Binary file foo4 matches The log is created, but remains empty. ... (1 Reply)
Discussion started by: chipperuga
1 Replies

6. Shell Programming and Scripting

ambiguous redirect error

This script has ambiguous redirect error. ... cd $HOME cd folder/work # search all subfolders in work directory find -mindepth 1 -maxdepth 1 -type d | while read directory do CUR_FOLDER="${directory#"./"}" cd $CUR_FOLDER chmod 644 * for ff in *; do if ; then ... (5 Replies)
Discussion started by: candyme
5 Replies

7. Shell Programming and Scripting

Redirect Output and Error in 2 different files

hi, i want to redirect my output & error if generated to two different files. I have written the code for redirecting the output, i dnt have ne idea how to go abt it for errors. I tried spooling which was given in one of the threads on this forum.But it didn't work.The script i wrote as a lot... (4 Replies)
Discussion started by: bankimmehta
4 Replies

8. Shell Programming and Scripting

Ambiguous output redirect error

Hi everyone, While I was trying to do DATE=`date +"%Y%m%d_%H%M%S"` STARTLOG=$TUXSTDDIR/start_$DATE.log tmboot -y > $STARTLOG 2>&1 I got an error i.e. Ambiguous output redirect error. Here the first part is to boot the account so there is nothing wrong with that.... (6 Replies)
Discussion started by: pareshan
6 Replies

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

10. Shell Programming and Scripting

Ping: redirect output and error

Hi, I use this function (now modified with elif) for check if a pc is up: check_pc() { $PING $PC 1 2> /dev/null if ; then check_dir #Other function echo "Begin backup operation for $PC" echo "$SMBTAR -s $PC -u $USER -p $PASS -x $SHARE$EXCL -t - | gzip -c >... (3 Replies)
Discussion started by: mbarberis
3 Replies
Login or Register to Ask a Question