shell-Special variables

Source: Internet
Author: User

    1. Position variable.

      $ $ Gets the file name of the currently executing shell script.

      [Email protected] ~]# vim 0.sh

      [email protected] ~]# cat 0.sh

      Echo

      [[Email protected] ~]# sh 0.sh

      0.sh

      [Email protected] ~]#

    2. If I put it in the full path, it will.

[email protected] ~]# sh/root/0.sh

/root/0.sh

$ A to-$ is the corresponding first variable, such as $ $ is the corresponding value of the initial variable, if it is $10, you want to use {} brackets, such as ${10}


[[email protected] ~]# sh 0.sh zhouyu

Zhouyu

By the way, SEQ is sending from which value to which value, such as command

Seq-s "" 1 10

Is that sending 1 to 10 is separated by a space,

[email protected] ~]# seq-s "$" 1

1 $ $4 $ $6 $7 $8 $9 $

$ #是指命令行参数的总个数. If you give the command line argument there are 10 then $ #就是10

DirName $ is to take the directory out of the script.

BaseName is taking out the name.

[email protected] ~]# cat 0.sh

dirname

basename

[email protected] ~]# sh/root/0.sh

/root

0.sh

[email protected] ~]#

You can take a look at the usage of the/etc/init.d/nfs file for these parameters.

This article is from "Love Zhou Yu" blog, please be sure to keep this source http://izhouyu.blog.51cto.com/10318932/1886164

shell-Special variables

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.