Quote:
Originally Posted by grail
Yes I found that out after I added all the colorizing
Not to fear, was an easy(ish) fix
|
Are you sure your code works?
My output:
Code:
94) lives 198) urpmi
95) urpmi 199) --auto
96) --auto 200) htmldoc
97) kdenlive 201) urpmi
98) urpmi 202) --auto
99) --auto 203) ksayit
100) pitivi 204) urpmi
101) # 205) --auto
102) Není 206) xsel
103) ve 207)
104) zdrojích 208) Finish
Choose a line:
1) It parsed word by word.
2) 208 to exit does not work
3) If I take if condition from your code and give it to my code, it does nothing. In the right part of it I see many escape sequences, letter by letter escaped. Maybe it is normal, but - this should be the problem. Maybe the test interprets the right part incorrectly. Maybe he needs some commands. Maybe we have different bash versions.
I have:
GNU bash, version 4.0.33(2)-release (i586-mandriva-linux-gnu)
Did you read what I wrote - I think the basic problem is this:
Code:
[ "$line" == "Finish" ] && pause
Debug putput is different:
Code:
'[' 'Finish' == Finish ']'
That means the problem is in interpreting $line.
Line should ocntent something like this:
Code:
line=$'\E[1;33m\nKonec\E[1;0m';
This is code which we should get from the script by awk.
But in real, here is something strange. If I use the select - choose Finish - then when debuging I don't see yellow color text of the Finish text. While if I use this command:
Code:
set -x
line=$'\E[1;33m\nKonec\E[1;0m'; # WARNING: this is not same as the line we get from awk!
[ "$line" == "Konec" ] && echo "OK"
1)
I see yellow text in output
2)
I see breakline in output!
This is output:
That could mean:
there is difference what we have got from awk and what we get by your command - trying to access the content as a array[index-1]
I would say that content got by
has the \n on end of line and yellow formatting, which need not to be seen while debugging test command (?)
If so, can you just to change last line of the content to remove this two things?