PS1换行颜色问题 [英] PS1 line-wrapping with colours problem

查看:113
本文介绍了PS1换行颜色问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的PS1变量:

Here's my PS1 variable:

PS1='\u:\W$(__git_ps1 "\e[32m\][%s]\e[0m\]")$ '

伟大工程拿起我的Git分支,但它在色彩表现活跃,使它们重叠当您使用长命令包装线的不幸的副作用。

Works great for picking up my Git branch, but it has the unfortunate side-effect of wrapping the lines when the colours are active, so that they overlap when you use long commands.

任何人都可以用魔法技能PS1帮我解决这个问题?

Can anyone with magic PS1 skills help me out to fix this?

推荐答案

明白了,要正确逃生的颜色需要的。

Got it, needed to escape the colours properly.

修正:

PS1='\u:\W$(__git_ps1 "\[\e[32m\][%s]\[\e[0m\]")$ '

这篇关于PS1换行颜色问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆