zoukankan      html  css  js  c++  java
  • Linux C/C++计划Shell命令大杂烩(1)

    1, 请参见发行信息

        cat /etc/issue


    2, 查看内核版本号

       uname -r 查看内核版本号

       uname -p 查看处理器类型32bit/64bit

       uname -n 查看网络主机名(or hostname)


    3,OpenJDK和JDK啥差别?

       Oracle JDK is based on the OpenJDK source code. In addition, it contains closed-source components. 也就是说,OpenJDK去掉了JDK中涉及一些版权问题的API和源码,功能比JDK少点。


    4,父Shell、子Shell

      当在运行一个Shell Script时,父Shell会依据Script程序的第一行#!之后指定的Shell程序开启一个子Shell环境,然后在子Shell中运行此Shell Script。一旦子Shell中的Script运行完成,此子Shell随即结束。回到父Shell中。不会影响父Shell原本的环境。子Shell环境拥有与父Shell同样的环境变量、标准输入、输出、错误等。


    5, source命令作用?

          能够用help source查看帮助文档。P.S. 点命令与source命令一样,使用方法为. filename [arguments]

          source: source filename [arguments]

                  Execute commands from a file in the current shell.


    Read and execute commands from FILENAME in the current shell.  The entries in $PATH are used to find the directory containing FILENAME.  If any ARGUMENTS are supplied, they become the positional parameters when FILENAME is executed.


        Exit Status:

        Returns the status of the last command executed in FILENAME; fails if FILENAME cannot be read.

      文件filename能够没有运行权限。

      在当前shell中运行和在子shell中运行的差别是,后者定义的变量和函数在运行结束后就消失了,而前者却能够保留下来。因此,若我们改动了/etc/profile里面的内容,如添加了环境变量。那么假设要马上生效的话,就必须使用source命令或者点命令在当前shell中运行一下。


    6, 环境变量

        (1)查看全部环境变量:

          $ set

          

        (2)查看某个环境变量:

          $ echo "$PATH"


       (3)环境变量设置:

    export ANT_HOME=/path/to/ant/dir

    export PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin

     (4) 持久化环境变量的文件:

         /etc/profile, 存放系统级环境变量的地方,对全部用户有效。设置完之后须要又一次登录才干生效。

         ~/.bashrc, 存放当前用户环境变量的地方,仅仅对当前用户有效。

    设置完之后仅仅须要又一次启动shell。

         当然,上面介绍的source命令能够马上生效。

     

    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    第06组Alpha冲刺(4/6)
    第06组Alpha冲刺(3/6)
    第06组Alpha冲刺(2/6)
    第06组 Alpha冲刺 (1/6)
    08-js函数
    07-数组
    06-js分支
    05-js运算符
    04-js变量
    03-css3D转换
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/4713291.html
Copyright © 2011-2022 走看看