redirecting output, including errors

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers redirecting output, including errors
# 1  
Old 09-18-2002
redirecting output, including errors

what's the proper syntax to redirect output, including all errors?

ls -la > direct.list makes out put file direct.list
but if i'm running a script and i want to include the errors, would i type something like:

myscript.scr 2> out_list.txt or will that get the errors only?
# 2  
Old 09-18-2002
ls -la > outputfile 2>&1
for sh/bash/ksh.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirecting output to file

Hi, I have created script which redirect the output to file.I am able to get the output in file but not in the format. Output :Content of the log which have 10 -15 lines. Actal :Line1 ..Line 2Line3 Line4 Line 5 Expected:Line1 Line 2 Line3 Please... (7 Replies)
Discussion started by: karthik771
7 Replies

2. Shell Programming and Scripting

Redirecting the output

For example, if we run the below command, symcfg list -thin -pool , results in an output most of the times and if the out is generated i'm able to redirect the output to a file. but sometimes it doesnt result any output and even though the output is being redirected, i can see "No Thin Pools "... (2 Replies)
Discussion started by: web2moha
2 Replies

3. UNIX for Dummies Questions & Answers

Redirecting errors of test command

Hello, Unix-Board! Normally, I would hide error messages in a shell script with command 2> path but test also prints out errors if I do that. The code of the script is (please don't tell me about bad coding :)): echo "Enter a number here" read number test $number -ge 0 && echo... (2 Replies)
Discussion started by: intelinside
2 Replies

4. Shell Programming and Scripting

redirecting output using if-then-else in awk

I am trying to filter records based on number of "|", delimiter in my application. If number of "|" is greater than 14 its a bad record, else its a good record. I have to redirect output to two different files based on the if-then-else evaluation in AWK. if number of | in file_0 > 14 ... (2 Replies)
Discussion started by: siteregsam
2 Replies

5. Shell Programming and Scripting

Need help redirecting output to a file including errors

Need help redirecting output to a file including errors if any,I have 2 script namely push.ksh and run.ksh, I'm scp'ing push.ksh to another server and executing remotely via run.ksh, the script run.ksh runs locally but does not capture any errors in "servername.out" file (I tried testing various... (10 Replies)
Discussion started by: mbak
10 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

help redirecting output from mailbot

Hello...I'm having problems redirecting output from a script from a mailbot. It is a perl script that has the email sent to op_shipper piped into it. I am receiving the email with sendmail and here is what my alias looks like for the script am I having problems with in /etc/aliases: ... (3 Replies)
Discussion started by: kuliksco
3 Replies

8. Shell Programming and Scripting

Redirecting OUTPUT

Hi, I want to move the output of a command/script to a file as well as to to be displayed on stdout. Can anybody help me in this. Thanks in advace .. -Chanakya M (1 Reply)
Discussion started by: Chanakya.m
1 Replies

9. Shell Programming and Scripting

including spaces in awk output

I need to tweek my awk output: #cat filename ab cd ef:ghi:jk lm:nop qrs #cat filename | awk '{ for(i=3;i<NF+1;i++) printf $i}' ef:ghi:jklm:nopqrs I would like the ouput to include the original spaces from columns 3 on: ef:ghi:jk lm:nop qrs any suggestions? (4 Replies)
Discussion started by: prkfriryce
4 Replies

10. UNIX for Advanced & Expert Users

redirecting the output of aspell

Hi, I have 2 identical servers both running aspell but for some reason I can't redirect the output to a file on one of them. This is what I'm trying to do: echo feck | aspell -l > errors.txt On one machine this works fine but the other it doesn't (the file is created but it is empty). ... (6 Replies)
Discussion started by: leekb
6 Replies
Login or Register to Ask a Question