zoukankan      html  css  js  c++  java
  • linux中source

    命令用法:
    source FileName
    作用:在当前bash环境下读取并执行FileName中的命令。
    注:该命令通常用命令“.”来替代。
    如:source /etc/profile 与 . /etc/profile是等效的。
    注意:source命令与shell scripts的区别是,
    source在当前bash环境下执行命令,而scripts是启动一个子shell来执行命令。这样如果把设置环境变量(或alias等等)的命令写进scripts中,就只会影响子shell,无法改变当前的BASH,所以通过文件(命令列)设置环境变量时,要用source 命令。

    此文章来之:http://zhidao.baidu.com/question/378390415.html

    ---------------------------------------------------------------
    source 命令是 bash shell 的内置命令,从 C Shell 而来。
    source 命令的另一种写法是点符号,用法和 source 相同,从Bourne Shell而来。
    source 命令可以强行让一个脚本去立即影响当前的环境。
    source 命令会强制执行脚本中的全部命令,而忽略文件的权限。
    source 命令通常用于重新执行刚修改的初始化文件,如 .bash_profile 和 .profile 等等。
    source 命令可以影响执行脚本的父shell的环境,而 export 则只能影响其子shell的环境。

    方法1:
    让/etc/profile文件修改后立即生效 ,可以使用如下命令:
    # .  /etc/profile
    注意: . 和 /etc/profile 有空格
    方法2:
    让/etc/profile文件修改后立即生效 ,可以使用如下命令:
    # source /etc/profile

    此文章来之: http://blog.chinaunix.net/uid-27200305-id-3319139.html
    ------------------------------------------------
  • 相关阅读:
    Codeforces Round #200 (Div. 2) E. Read Time(二分)
    Codeforces Round #160 (Div. 2) D. Maxim and Restaurant(DP)
    TC SRM 593 DIV1 250
    TC SRM 593 DIV2 1000
    HDU 2825 Wireless Password(AC自动机+DP)
    Codeforces Round #203 (Div. 2)
    TC SRM 591 DIV2 1000
    HDU 4758 Walk Through Squares(AC自动机+DP)
    CF 346B. Lucky Common Subsequence(DP+KMP)
    HDU 4753 Fishhead’s Little Game(DFS)
  • 原文地址:https://www.cnblogs.com/2zhyi/p/2870981.html
Copyright © 2011-2022 走看看