Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert 'echo' to 'echo -e' to enable color escape codes #44

Closed
wants to merge 1 commit into from
Closed

Convert 'echo' to 'echo -e' to enable color escape codes #44

wants to merge 1 commit into from

Commits on Dec 8, 2011

  1. Convert 'echo' to 'echo -e' to enable color escape codes

    Not sure how this wasn't noticed before now, but I suppose it's
    possible that some shells come with a version of 'echo' where the
    '-e' flag is considered active by default. However, on my system
    (CentOS 6.0, bash 4.1.2) doing any sort of command that echoes color
    codes prints garbage like the following:
    
        [user@machine ~]$ n
          \033[32mο\033[0m 0.6.5 \033[90m\033[0m
    
    All this commit does is add the '-e' flag to only those 'echo'
    commands that are using color escape codes. This causes the above
    command to print its output as expected.
    
    I'm not sure if this will break anything on shells that assume '-e'
    implicitly.
    
    For reference, here is the section of the 'echo' man page regarding
    '-e':
    
       -e     enable interpretation of backslash escapes
    
           If -e is in effect, the following sequences are recognized:
    
           \\     backslash
    
           \a     alert (BEL)
    
           \b     backspace
    
           \c     produce no further output
    
           \e     escape
    
           \f     form feed
    
           \n     new line
    
           \r     carriage return
    
           \t     horizontal tab
    
           \v     vertical tab
    
           \0NNN  byte with octal value NNN (1 to 3 digits)
    
           \xHH   byte with hexadecimal value HH (1 to 2 digits)
    bstrie committed Dec 8, 2011
    Configuration menu
    Copy the full SHA
    70a6aac View commit details
    Browse the repository at this point in the history