【问题标题】:Force base_profile to run强制 base_profile 运行
【发布时间】:2010-10-12 10:42:06
【问题描述】:

当我登录到 sun box 时:SunOS domain.com 5.8 Generic_117350-57 sun4u sparc SUNW,Sun-Fire-V240

我从 sh shell 开始:SHELL=/bin/sh

我输入 bash 来启动一个 bash shell,然后必须输入 . .bash_profile 加载我的个人资料。有没有办法可以设置为自动加载配置文件?

【问题讨论】:

    标签: bash solaris


    【解决方案1】:

    文件.bash_profile 在登录时运行。当从非登录会话运行 bash 时,将运行文件 .bashrc

    尝试将此添加到您的.bashrc

    source ~/.bash_profile
    

    【讨论】:

      【解决方案2】:

      像这样运行 bash 会导致它获取源 /etc/bash.bashrc 然后 ~/.bashrc 代替 .bash_profile (和其他文件)。因此,将. ~/.bash_profile 放入~/.bashrc 中,(或放入/etc/bash.bashrc 中以对所有用户执行此操作)。

      【讨论】:

        【解决方案3】:

        .bash_profile 仅用于登录 shell,对于非登录 shell(如您的),bash 使用 .bashrc

        最简单的方法是将. .bash_profile 添加到您的.bashrc

        您还必须确保不在非交互式 shell 中打印出任何内容,否则您可能会破坏 scp/sftp。

        【讨论】:

          【解决方案4】:

          。 ~/.bash_profile

          在 ~/.bashrc 中(注意无限循环!)。我自己不使用它,因为我在 .bashrc 中开始使用大多数东西(除了,嗯,环境。东西等等)。

          【讨论】:

            猜你喜欢
            • 2015-09-17
            • 1970-01-01
            • 2019-03-21
            • 2017-03-05
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多