unix - Shell read from cat line by line into array -


i have command outputs that:

lucid32 lucid64 

i need read array. in particular case need equivalent of:

boxes =(lucid32 lucid64) 

i tried read that:

boxes=(`mycommand list | tr '\n' ' '`) 

but returns $'\033'[0klucid

how can fix that?

updated:

it looks didn't work because command outputs bunch of junk:

\r\e[0klucid32\n\r\e[0klucid64\n 

what shell? don't support arrays.

the "junk" see terminal control codes cursor movement or text coloring, etc. it's code clear end of line.

what command outputting characters? commands automatically disable codes when output going somewhere other tty. others have command-line options turn off. there utilities strip codes you.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -