Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a complex text in ksh

Status
Not open for further replies.

w5000

Technical User
Nov 24, 2010
223
PL

hello,

could someone please tell me, why the bracket [highlight #EF2929]}[/highlight] appears on the output?

Code:
$ ( echo A B C D ::;sed 's/\(.\{1\}\)/\1 /g' vvvv|sort|while read A B C D;do printf "$A $B $C $D :: "; [ $A -eq 1 -a $B -eq 1 -a $C -eq 1 -a $D -eq 1 ] && echo "errors: A and B and C and D" || { [ $A -eq 1 -a $B -eq 0 -a $C -eq 0 -a $D -eq 0 ] && echo "errors: A" || { [ $A -eq 1 -a $B -eq 1 -a $C -eq 0 -a $D -eq 0 ] && echo "errors: A and B" || { [ $A -eq 1 -a $B -eq 1 -a $C -eq 1 -a $D -eq 0 ] && echo "errors: A and B and C" || { [ $A -eq 1 -a $B -eq 1 -a $C -eq 0 -a $D -eq 1 ] && echo "errors: A and B and D" || { [ $A -eq 1 -a $B -eq 0 -a $C -eq 1 -a $D -eq 1 ] && echo "errors: A and C and D" || { [ $A -eq 1 -a $B -eq 0 -a $C -eq 0 -a $D -eq 1 ] && echo "errors: A and D" || { [ $A -eq 1 -a $B -eq 0 -a $C -eq 1 -a $D -eq 0 ] && echo "errors: A and C" || { [ $A -eq 0 -a $B -eq 1 -a $C -eq 0 -a $D -eq 0 ] && echo "errors: B" || { [ $A -eq 0 -a $B -eq 1 -a $C -eq 1 -a $D -eq 0 ] && echo "errors: B and C" || { [ $A -eq 0 -a $B -eq 1 -a $C -eq 1 -a $D -eq 1 ] && echo "errors: B and C and D" || { [ $A -eq 0 -a $B -eq 1 -a $C -eq 0 -a $D -eq 1 ] && echo "errors: B and D" || { [ $A -eq 0 -a $B -eq 0 -a $C -eq 1 -a $D -eq 0 ] && echo "errors: C" || { [ $A -eq 0 -a $B -eq 0 -a $C -eq 1 -a $D -eq 1 ] && echo "errors: C and D" || { [ $A -eq 0 -a $B -eq 0 -a $C -eq 0 -a $D -eq 1 ] && echo "errors: D" || [highlight #FCE94F]echo "errors: none"[/highlight] }; } } } } } } } } } } } } } }; unset A B C D;done )
A B C D ::
0 0 0 0 :: errors: none [highlight #EF2929]}[/highlight]
0 0 0 1 :: errors: D
0 0 1 0 :: errors: C
0 0 1 1 :: errors: C and D
0 1 0 0 :: errors: B
0 1 0 1 :: errors: B and D
0 1 1 0 :: errors: B and C
0 1 1 1 :: errors: B and C and D
1 0 0 0 :: errors: A
1 0 0 1 :: errors: A and D
1 0 1 0 :: errors: A and C
1 0 1 1 :: errors: A and C and D
1 1 0 0 :: errors: A and B
1 1 0 1 :: errors: A and B and D
1 1 1 0 :: errors: A and B and C
1 1 1 1 :: errors: A and B and C and D
$

the input file is:

Code:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
 
Replace this:
echo "errors: none" };
with this:
echo "errors: none";

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OOps, forgot to explain:
you had 15 } for only 14 {

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top