LoginSignup
4
4

More than 5 years have passed since last update.

shとbashを区別してbashのときだけ~/.bash_profileを読ませる~/.profileの書き方

Last updated at Posted at 2013-01-25

OS Xの/etc/profileに答えがありました。

/etc/profile
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
fi

というわけで~/.profileでも真似をします。

~/.profile
### -*- mode: sh; coding: utf-8; -*-

if [ "${BASH-no}" != "no" ]; then
    if [ -f "${HOME}/.bash_profile" ]; then
        . "${HOME}/.bash_profile"
    fi
fi
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4