linux - I cannot print color escape codes to the terminal -


when run script:

fn main() {     // \033[0;31m <- red     // \033[0m <- no color     println!("\033[0;31mso\033[0m") } 

i expect get

so #in red letters 

however, get:

33[0;31mso33[0m 

when ran similar script in go or python, expected output. going on? missing? how fix this?

i using:

$ rustc --version rustc 1.3.0 (9a92aaf19 2015-09-15) $ lsb_release -a no lsb modules available. distributor id: ubuntu description:    ubuntu 14.04.3 lts release:    14.04 codename:   trusty 

rust 1.3.0 not seem support octal escape strings such \033. instead, can use hexadecimal escape strings \x1b.

fn main(){   println!("\x1b[0;31mso\x1b[0m") } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -