-
Notifications
You must be signed in to change notification settings - Fork 340
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
Use printf instead of echo in colors.sh #23
base: master
Are you sure you want to change the base?
Conversation
`echo \e[0;30m` (using both the built-in command and /bin/echo) doesn't recognize the "\e" escape sequence on OS X.
This fixed my prompt on OS X. Before it was printing "(master)\e[0m$" from the txtrst escape sequence. |
Was master printing in color? |
Yes: https://imgur.com/a/99n9jkG (using echo) Here it is with this patch: https://imgur.com/a/PEhL91H |
Weird, I'm guessing your tput doesn't recognize Changing |
Darwin Kernel Version 17.7.0 Like I said, switching to printf fixes the issue. |
Right, but the only reason echo or printf are called is because tput fails. So in this case, it's because "tput sgr 0" fails. That's weird, though, because I'm using Darwin 17.6.0 (aka macOS 10.13.5) and it appears to work fine for me. Maybe it has something to do with your terminal, then. At any rate, this patch would be good to merge for portability reasons in cases like yours. |
Ah you're right. I wasn't thinking about the logic. Are you sure that your
|
echo
(both the built-in command and /bin/echo) doesn't recognize the "\e" escape sequence on OS X. (This may not be an issue, since$TERM
is typically only unset in non-interactive environments, so these could theoretically also be replaced with an emptyecho
orprintf
.)