你怎么运行的* nix上的登录脚本? [英] How do you run a script on login in *nix?

查看:116
本文介绍了你怎么运行的* nix上的登录脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我曾经知道如何做到这一点,但......你怎么在UNIX上登录时运行脚本(bash的是OK)?

I know I once know how to do this but... how do you run a script (bash is OK) on login in unix?

推荐答案

猛砸

当击启动时,它在各种不同的方式执行这些命令
  脚本。

When Bash starts, it executes the commands in a variety of different scripts.

当Bash是作为交互
  登录shell,它首先读取和
  从文件执行命令
  / etc / profile文件,该文件是否存在。
  读取该文件后,它会寻找
  在〜/ .bash_profile,〜/ .bash_login文件,并
  〜/ .profile中,以该顺序,并读出
  和执行从所述第一命令
  一个存在并且是可读的。

When Bash is invoked as an interactive login shell, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

当一个登录shell退出,Bash读取
  并执行从文件的命令
  〜/ .bash_logout中,如果存在的话。

When a login shell exits, Bash reads and executes commands from the file ~/.bash_logout, if it exists.

当一个交互的shell,是不是
  登录shell启动时,bash读取
  和〜/ .bashrc中执行命令,
  该文件是否存在。这可能是
  通过使用--norc选项抑制。
  该文件--rcfile选项将迫使
  巴什读取和执行命令
  文件,而不是〜/ .bashrc中。

When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc.

这篇关于你怎么运行的* nix上的登录脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆