美文网首页
Unix 环境变量设置

Unix 环境变量设置

作者: jeanroy | 来源:发表于2018-05-21 13:13 被阅读0次

    1. Environment Variables

    • operating system: type echo $OSTYPE
      show detail:

      USER: your login name
      HOME: the path name of your home directory
      HOST: the name of the computer you are using
      ARCH: the architecture of the computer processor
      DISPLAY: the name of the computer screen to display X windows
      PRINTER:  the default printer to send print jobs
      PATH:  the directory the shell should search to find a command
      
    • environment set:
      type: setenv

    • environment show:
      type: printenv or env

    • environment unset:
      type: unsetenv

    2. Shell Variables

    • echo history: the vaule of how many shell commands to save
    • cwd: current working directory
    • home: the path name of your home directory
    • path: the directories the shell should search to find a command
    • prompt: the text string used to prompt for interactive commands shell

    set or display shell variables:
    type: set xxx
    unset shell variables:
    type: unset xxx
    show all shell variables:
    type: set | less

    3. Using and setting variables

    default file: ~/.login (C shell) or ~/.cshrc(TC shell)
    ~/.login: set conditions which will apply to the whole session and to perform actions that are relevant only at login.

    ~/.cshrc: set conditions and perform actions specific to the shell and to each invacation of it

    recommand: set ENVIRONMENT variables in the .login file , and SHELL variables in the .cshrc file
    warning: NEVER put commands that run graphical displays (e.g. a web browser) in your .cshrc or .login file

    4. Setting shell variables in the .cshrc file

    1. edit ~/.cshrc file: set history = 200
    2. % source .cshrc
    3. % echo $history

    5. Setting the path

    • % set path = ($path ~/xxx/xx/bin)
    • add this line to .cshrc file: set path = ($path ~/xxx/xx/bin)

    相关文章

      网友评论

          本文标题:Unix 环境变量设置

          本文链接:https://www.haomeiwen.com/subject/oulfjftx.html