Bash 当一个新的;屏幕“;会议召开了吗?

Bash 当一个新的;屏幕“;会议召开了吗?,bash,macos,unix,terminal,Bash,Macos,Unix,Terminal,文件:~/.bash\u配置文件() 每当我在Mac上创建一个新的屏幕会话时,终端窗口就会显示出来 bash: git_color: command not found bash: git_branch: command not found 为什么功能git_color和git_分支没有在屏幕上执行 是否有其他方法可以实现它?我不完全确定屏幕的工作原理 看起来,.bash\u profile没有被执行,因为屏幕没有创建登录shell。[1] 按照常规bash规则,PS1由screen发布的sh

文件
~/.bash\u配置文件
()

每当我在Mac上创建一个新的
屏幕
会话时,终端窗口就会显示出来

bash: git_color: command not found
bash: git_branch: command not found
为什么功能
git_color
git_分支
没有在
屏幕上执行


是否有其他方法可以实现它?

我不完全确定
屏幕的工作原理

看起来,
.bash\u profile
没有被执行,因为
屏幕
没有创建登录shell。[1]

按照常规bash规则,
PS1
screen
发布的shell读取,因为您导出了它

i、 例如,你这样做了:

export PS1
对您的函数也执行同样的操作。[2]

定义两个函数后,向
.bash\u配置文件添加两个命令:

export -f git_color
export -f git_branch
或者,也可以将这些函数和
PS1
添加到
.bashrc

[1]


[2]

Alternative move
git_color
git_branch
.bash_profile
.bashrc
未来,有关配置和使用交互式shell环境的问题更适合我们的姐妹站点。