mac-profile

Mac 中定义与Linux一样的profile.d

  • 首先Mac是没有profile.d的
  • 在/etc/profile文件中添加

for sh in /etc/profile.d/*sh; do
    [ -r $sh ] && . $sh
done
unset sh
  • install -o root -g wheel -d /etc/profile.d
  • 在该目录下创建一个mysql.sh

export PATH=$PATH:/usr/local/mysql/bin
  • 有一个问题: 可以是Mac不支持profile.d目录的缘故, 所以在profile中执行的都是在子进程中的, 所以无效的, 我们需要在登录shell时执行. /etc/profile文件

mac 原生的配置path的方法

  • 看一下/etc/paths和/etc/paths.d就知道了
  • 推荐使用这个

猜你喜欢

转载自www.cnblogs.com/megachen/p/9692567.html