(a) The first day of the shell

Source: Internet
Author: User

    • CentOS default shell version: Bash

      echo $SHELL
    • Opening language ID: #!/bin/bash

      在执行bash脚本的时候,内核根据#!解释器来确定改用哪个程序解释这个脚本中的内容
    • Script comments

      在shell中,#开头的是注释;
    • Execution of Shell scripts

      方式一:bash script-name或sh script-name (推荐使用)方式二:./script-name (当前路径下执行脚本,必须要给执行权限)方式三:source script-name 方式四:cat scritps-name|bash
    • Calling a defined variable in the script: no way to use bash script-name, only source script-name can be used to invoke variables in the script

      [[email protected] scripts]# cat test.sh user=`whoami`[[email protected] scripts]# bash test.sh [[email protected] scripts]# echo $user[[email protected] scripts]# source test.sh [[email protected] scripts]# !echoecho $userroot
    • The system environment variable library is called in the script

      .  /etc/init.d/functions  

(a) The first day of the shell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.