![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| direct output to a file then email it | llsmr777 | UNIX for Dummies Questions & Answers | 2 | 11-21-2007 02:21 AM |
| How to direct FTP command to use a specific IP add or NIC ? | pray44u | SUN Solaris | 5 | 06-02-2006 12:49 AM |
| Direct disk access | Lopatonosec | High Level Programming | 3 | 05-31-2005 12:39 PM |
| Error: No direct declarator preceding "(" | nik | High Level Programming | 1 | 05-17-2004 08:54 AM |
| direct transmission of files via TCP/IP | darkspace | High Level Programming | 5 | 08-26-2002 02:00 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Re-direct the error msg to log file
Hi All,
I have an expression as follows:- a=`expr ${i} + ${j}` >> $log_file 2>&1 Here, if any of the values i or j or both happens to be empty then the "expr" returns error as "expr: 0402-050 Syntax error." My problem is I am not able to re-direct this error to the log file. Its is getting displayed on the console itself which I don't want to. Any help please..... |
|
||||
|
Thanks zazzybob
It worked for me. I did the following:- Code:
a=`expr ${i} + ${j} >> $log_file 2>&1`
|
|
|||||
|
But you also want to assign to a variable, correct?
Code:
a=`( expr $i + $j | tee -a $log_file ) 2>> $log_file` Cheers ZB |
|
||||
|
You are right zazzybob. I got carried away!!
The variable "a" was not getting populated with the value returned by the expression, with my code. Your code just works perfect. Once again Thanks. |
| Sponsored Links | ||
|
|