Redirecting to Error File


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Redirecting to Error File
# 1  
Old 10-12-2007
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.

I know that if we could comment out the echo statements it wouldn't fail. But i thought if we could do something like, redirecting the stdout to stderr then it shouldn't be a problem.

So is there a way of doing this 'redirecting the stdout to stderr' by default and if we could please let me know.

-Lorcan
# 2  
Old 10-12-2007
quick google
  • The following command saves stdout and stderr to the files "out.txt" and "err.txt", respectively.

    [root@server /root]# ./cmd 1>out.txt 2>err.txt
http://www.cpqlinux.com/redirect.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: Print Error While Redirecting output in multiple Files

Hi, I have a following code in which I am unable to redirect to multiple files. Can anybody please help with some corrections awk -F, '{ if ( substr($1,26,2)=="02" && substr($1,184,14)=="MTSCC_VALFIRST") { array1++ array2++ array3++ } else if (substr($1,26,2)=="03" &&... (4 Replies)
Discussion started by: siramitsharma
4 Replies

2. Shell Programming and Scripting

Redirecting STDERR to file and screen, STDOUT only to file

I have to redirect STDERR messages both to screen and also capture the same in a file but STDOUT only to the same file. I have searched in this formum for a solution, but something like srcipt 3>&1 >&2 2>&3 3>&- | tee errs doesn't work for me... Has anyone an idea??? (18 Replies)
Discussion started by: thuranga
18 Replies

3. Shell Programming and Scripting

extracting line numbers from a file and redirecting them to another file

i have applied the following command on a file named unix.txt that contains the string "linux from the text" grep -n -i -w "linux from the text" unix.txt and the result is 5:Today's Linux from the text systems are split into various branches, developed over time by AT&T as well as various... (5 Replies)
Discussion started by: arindamlive
5 Replies

4. Shell Programming and Scripting

Reading UNIX commands from file and redirecting output to a file

Hi All I have written the following script: #!/bin/ksh while read cmdline do echo `$cmdline` pid="$cmdline" done<commands.txt =========== commands.txt contains: ps -ef | grep abc | grep xyz |awk '{print $2}; My objective is to store the o/p of the command in a variable and do... (8 Replies)
Discussion started by: rahulparo
8 Replies

5. Shell Programming and Scripting

Regarding Redirecting a command's default error message in script

Hi, I just need a small help. I have this simple script to check a huge list of IDs if they exist or not on a server. Before running I have tested it with only 5-6 IDs. Script works fine. But what I need it should not display the message of command's error message. That means if suppose an ID... (3 Replies)
Discussion started by: raj100
3 Replies

6. Shell Programming and Scripting

Redirecting output to file

Hi, Below is the whole string which is to be redirected to the new file. su - oracle -c "exp $user/$pass file=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.dmp log=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.log tables=table1,table2 statistics=none" ... (3 Replies)
Discussion started by: milink
3 Replies

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

8. Shell Programming and Scripting

Is there a way to tee stderr from a command that's redirecting error to a file?

I'm not a complete novice at unix but I'm not all that advanced either. I'm hoping that someone with a little more knowledge than myself has the answer I'm looking for. I'm writing a wrapper script that will be passed user commands from the cron... Ex: ./mywrapper.sh "/usr/bin/ps -ef |... (1 Reply)
Discussion started by: sumgi
1 Replies

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

10. Shell Programming and Scripting

redirecting a file

Hi, I have a normal txt file which contains say 5 lines. in that i need to change few of the the parameters dynamically. for eg.. line 1..contains account line 2 contains date line 3 contains user .. .. .. i will be taking the input using read command and store it in variables... (3 Replies)
Discussion started by: wip_vasikaran
3 Replies
Login or Register to Ask a Question