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

问题描述 投票:19回答:6

我不知道为什么,但我的Git Bash终端显示34米和随机数字的地方。这是一个截图。 enter image description here

谢谢你的帮助。

bash laravel terminal command line
6个回答
15
投票

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


5
投票

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


4
投票

看起来颜色代码没有正确显示:

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

但是你需要一个带前缀的转义字符:

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

  • \和
  • \033
  • \ X1B

在这里查看更多:http://misc.flogisoft.com/bash/tip_colors_and_formatting


这里也讨论了同样的问题:ANSI color escape sequences seem broken for arc in git bash on windows

基本上提到了hackish修复:

php artisan tinker | cat 
php artisan tinker | echo -e

其他一些资源:

ANSI color in git is not displayed correctly In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec


2
投票

列出的解决方案都没有为我工作,在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

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

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

希望这可以帮助


1
投票

解决颜色问题下载并安装此https://github.com/adoxa/ansicon

安装步骤:

1)Extract The folder and Navigate to x86/64 (Depends upon your system)
2)Open Cmd
3)ansicon.exe -I

简单:)


1
投票

这是GIT版本的兼容性问题。 在我的情况下,删除最新版本并下载并安装GIT版本2.10。问题解决了。 https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1

© www.soinside.com 2019 - 2024. All rights reserved.