|
Home > Archive > Unix questions > November 2006 > if loop in UNIX
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| chaitu 2006-11-22, 1:17 pm |
| Hi all,
I have a doubt using IF loop in UNIX. I have the following statement.
if [[ `cat
/udb/db2enpid/clnpis/udb09/scripts/export_table_bluee_5/count_messages_begin_bluee|wc
-l` != 10 ]]
then
> print -- "not equal"
> else
> print -- "equal"
> fi
not equal
but when i do wc on the file it gives
cat
/udb/db2enpid/clnpis/udb09/scripts/export_table_bluee_5/count_messages_begin_bluee|wc
-l
10
The result i want to get out of the if loop is equal. Can somebody help
me please.
Thanks in advance
| |
|
| In article <1164207250.127338.208560@h54g2000cwb.googlegroups.com>,
"chaitu" <chaituonweb@gmail.com> wrote:
> Hi all,
> I have a doubt using IF loop in UNIX. I have the following statement.
>
> if [[ `cat
> /udb/db2enpid/clnpis/udb09/scripts/export_table_bluee_5/count_messages_begin_b
> luee|wc
> -l` != 10 ]]
> then
> not equal
>
> but when i do wc on the file it gives
>
> cat
> /udb/db2enpid/clnpis/udb09/scripts/export_table_bluee_5/count_messages_begin_b
> luee|wc
> -l
> 10
>
> The result i want to get out of the if loop is equal. Can somebody help
> me please.
>
> Thanks in advance
You need to use -ne for numerical comparison instead of != which is for
string comparison. That will correct the problem.
Boyd
|
|
|
|
|