Mac OSX n00b:什么是.login文件?

时间:2015-12-08 19:04:14

标签: macos sh

首先,我正在使用Mac OS X.其次,我正在尝试安装一些说:

  

如果您包含此行(或来源$CALDB/software/tools/caldbinit.sh   对于.login文件中的Bourne shell用户,然后CALDB将是   每次登录时都可以使用。

.login文件究竟是什么?它在哪里可以找到?

1 个答案:

答案 0 :(得分:1)

On *nix systems, each time you login, it looks for a file named .login and executes any commands it finds in the file. Much like when you start a new C shell, the system looks for a file named .cshrc and executes it.

Though OSX uses other ways to implement this functionality, .login is still recognized. Typically .login file includes a command to "source" (read and execute) a standard system login file that sets the standard PATH, TERM, and PROMPT variables. Others such as your CALDB installation want to be initialized at login time by inserting the appropriate source line:

$ echo $PATH
/usr/local/bin:/usr/bin: /cygdrive/C:/Program Files/Java/jdk1.8.0_65:/cygdrive/c/Program Files/Java/jdk1.8.0_65/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/C:/IPS/mulval/lib:/usr/bin:/cygdrive/c/IPS/XSB:/cygdrive/c/IPS/XSB/config/x64-pc-windows/bin/xsb.exe:/cygdrive/c/IPS/XSB/bin/xsb:/cygdrive/c/IPS/XSB/config/x64-pc-windows/bin/xsb.dll:/cygdrive/c/IPS/XSB/config/i686-pc-cygwin/bin/xsb.exe:/cygdrive/c/IPS/XSB/config/i686-pc-cygwin/bin/xsb.dll:/cygdrive/c/IPS/XSB

Note you may have to substitute the literal path for $CALDB in the path above since that var may not be initialized at the time of login when this script is run.

Addendum:

.login is typically in the home directory when using csh or tsch shells. If it's not there, you'll have to create it. However, depending on the version of OSX you are using you may have other options or different ways of achieving the same effect. Follow the documentation (link provided above) for the best option for your version of OS X.