zoukankan      html  css  js  c++  java
  • CentOS 转义字符

    常用转义字符

    反斜杠():使反斜杠后面的一个变量变为单纯的字符串。
    单引号(''):转义其中所有的变量为单纯的字符串。
    双引号(""):保留其中的变量属性,不进行转义处理。
    反引号(``):把其中的命令执行后返回结果(1左边的那个和波浪线一起的按键),``括起来的内容代表一个变量

    用例

    price=5
    [es@bigdata-senior01 ~]$ echo "this is $price"
    this is 5
    [es@bigdata-senior01 ~]$ echo 'this is $price'
    this is $price
    [es@bigdata-senior01 ~]$ echo "uname -a" uname -a [es@bigdata-senior01 ~]$ echo 'uname -a' uname -a

    #反引号,效果和$()相同,反引号尽量少用,主要是容易和(')号混淆 [es@bigdata-senior01 ~]$ echo `uname -a` Linux bigdata-senior01.home.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

    [es@bigdata-senior01 ~]$ echo $(uname -a)
    Linux bigdata-senior01.home.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

    [es@bigdata-senior01 ~]$ echo "this is $$price" this is 1521price [es@bigdata-senior01 ~]$ echo "this is $$price" this is $5

    上面的1521是什么,实际上$$是提取当前进程的PID
    [es@bigdata-senior01 ~]$ echo $$
    1521
    [es@bigdata-senior01 ~]$ ps
       PID TTY          TIME CMD
      1521 pts/1    00:00:00 bash
      1925 pts/1    00:00:00 ps



  • 相关阅读:
    83. Remove Duplicates from Sorted List
    35. Search Insert Position
    96. Unique Binary Search Trees
    94. Binary Tree Inorder Traversal
    117. Populating Next Right Pointers in Each Node II
    116. Populating Next Right Pointers in Each Node
    111. Minimum Depth of Binary Tree
    169. Majority Element
    171. Excel Sheet Column Number
    190. Reverse Bits
  • 原文地址:https://www.cnblogs.com/asker009/p/10239499.html
Copyright © 2011-2022 走看看