cc icon indicating copy to clipboard operation
cc copied to clipboard

5.关于 .bash_profile和.bashrc

Open ccforward opened this issue 10 years ago • 2 comments

主要测试了Mac下使用情况:

  • ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件只load一次。
  • ~/.bashrc:该文件包含了专属于登录用户的bash shell的bash信息。每次新开一个bash或者登录都会reload一次。

建议做法

  • 把 PATH 放入 .profile 文件
  • 把 alias 和 功能函数 放入 .bashrc 文件
  • 然后 .bash_profile
#!/bin/bash
#
# CRM .bash_profile Time-stamp: "2008-12-07 19:42"
#
source ~/.profile # Get the paths
source ~/.bashrc  # get aliases
#
#- end

ccforward avatar Dec 24 '14 01:12 ccforward

最近遇到了个问题: 把vscode的环境变量放入了~/.bash_profile, source之后在打开其他的窗口,环境变量还是不生效

ZhyCong avatar Dec 01 '17 09:12 ZhyCong

@congzhaoyang 你有用 oh-my-zsh 嘛?

ccforward avatar Dec 01 '17 09:12 ccforward