工匠显示插入"32m","34; 4m"和类似

Phi*_* Y. 24 bash terminal command line laravel

我不知道为什么,但我的Git Bash终端显示34米和随机数字的地方.这是一个截图.在此输入图像描述

谢谢你的帮助.

Pla*_*cid 15

尝试将终端的Git Bash选项更改为xterm-256color.归功于:http://www.techhelp.pw/git-bash-using-laravel-artisan-displays-escaped-characters/

  • 我不得不打开和关闭(我认为) (2认同)

Pet*_*ete 7

另一个选择是使用--no-ansi开关运行Laravel脚本,这将完全禁用ANSI代码。

  • 这是对我有用的唯一解决方案。我已经尝试过用几种不同的方式显示整个颜色,但这并不能奏效。我在Windows10机器上。谢谢皮特! (2认同)

小智 7

列出的解决方案都没有对我有用,在Git / etc / bash.bashrc中添加这些行即可解决该问题。

# remove the winpty PHP aliases
unalias $(alias | grep winpty | grep php | cut -d"=" -f1 | cut -d" " -f2)

# support ansi color
export ANSICON=true
Run Code Online (Sandbox Code Playgroud)

我在https://blog.kmelia.net/testing/coloration-dans-git-bash/123找到了解决方案

我在Windows 10上的Windows上使用git bash,我的git版本是2.21.0

希望这可以帮助


and*_*lrc 4

颜色代码似乎未正确显示:

[34m是蓝色前景色,并且[39m是默认前景色。

但您将需要一个前缀转义字符:

在 Bash 中,<Esc>可以使用以下语法获取字符:

  • \e
  • \033
  • \x1B

在此处查看更多信息:http://misc.flogisoft.com/bash/tip_colors_and_formatting


这里也讨论了同样的问题:ANSI color escape strings might bad for arc in git bash on windows

基本上提到了黑客修复:

php artisan tinker | cat 
php artisan tinker | echo -e
Run Code Online (Sandbox Code Playgroud)

其他一些资源:

git 中的 ANSI 颜色未正确显示
在 Windows 7 上的 Git Bash 中,运行 Cucumber 或 rspec 时颜色显示为代码