应在主目录中的.bashrc中自动加载? [英] Should the .bashrc in the home directory load automatically?

查看:228
本文介绍了应在主目录中的.bashrc中自动加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.bashrc文件添加斯卡拉,但是当我关掉我的Mac和重新打开它没有找到它。当我做

 源的〜/ .bashrc

一切恢复正常。我想说的问题是,与一般的整个文件,但问题是我在那里有其他的事情,以前也工作得很好,但问题是斯卡拉执着。任何人都知道这是为什么,并解释为什么我收到这个问题?这是什么在我的.bashrc文件,它正常运行RVM和mysql,但不斯卡拉:

  PATH = $ PATH:$ HOME / .rvm / bin中#添加RVM到PATH的脚本
出口PATH =在/ usr /本地/ MySQL的/斌:$ PATH
出口PATH =/用户/ Zeroe /斯卡拉-2.9.1-1 /斌:$ PATH


解决方案

您的外壳可能是一个登录shell,在这种情况下,bash中读取各种配置文件的文件依次是:


  1. / etc / profile文件

  2. 〜/ .bash_profile中

  3. 〜/ .bash_login文件

  4. 〜/ .profile文件

这是典型的源〜/ .bashrc中从这些文件中的一个,所以你得到登录shell相同的配置也是如此。

这是我的〜/ .profile文件包含:

 #〜/ .profile文件:由命令间preTER为登录shell执行。
#此文件不被bash的(1),如果在〜/ .bash_profile或〜/ .bash_login文件阅读
#存在。
#看到的/ usr /共享/ DOC /庆典/例子/启动,文件的例子。
#该文件位于在bash-doc包。#默认的umask设置在/ etc / profile文件;用于设置的umask
#为ssh登录,安装和配置的libpam-umask的包。
#umask 022如果运行bash#
如果[-n$ BASH_VERSION];然后
    #include如果它存在的.bashrc
    如果[-f$ HOME / .bashrc中];然后
    。 $ HOME / .bashrc中
    科幻
科幻#设置PATH,因此包括用户的私人斌(如果存在)
如果[-d$ HOME / bin中];然后
    PATH =$ HOME /斌:$ PATH
科幻
出口LANGUAGE =EN_US:EN
出口LC_MESSAGES =的en_US.UTF-8
出口LC_CTYPE =的en_US.UTF-8
出口LC_COLLATE =的en_US.UTF-8

I added scala in my .bashrc file, but when I shut off my mac and turn it back on it does not find it. When i do

source ~/.bashrc 

all is back to normal. I would say the issue is with the whole file in general, but the problem, is I have other things in there that have worked just fine before, but the problem is persistent with scala. Anybody know why this is and explain why I am getting the problem? This is whats in my .bashrc file, which runs rvm and mysql correctly, but not scala:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH="/usr/local/mysql/bin:$PATH"
export PATH="/Users/Zeroe/scala-2.9.1-1/bin:$PATH"

解决方案

Your shell is probably a login shell, in which case bash will read various profile files in order:

  1. /etc/profile
  2. ~/.bash_profile
  3. ~/.bash_login
  4. ~/.profile

It's typical to source ~/.bashrc from one of those files so you get the same config for login shells as well.

This is what my ~/.profile contains:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
export LANGUAGE="en_US:en"
export LC_MESSAGES="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"

这篇关于应在主目录中的.bashrc中自动加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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