Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux argument references and command substitution     - Between the two to achieve the main MySQL database synchronization from (Database)

- Oracle 11gr2 new APPEND_VALUES tips (Database)

- Docker use Dockerfile created since the launch of the service support SSH container mirror (Server)

- Linux network security backdoor technology and advanced skill practice (Linux)

- To install minimize RHEL / CentOS 7 (Linux)

- How to view the Linux QPS (Linux)

- Linux RPM (Linux)

- Java Class file format parsing (Programming)

- Oracle Linux 7.1 install Oracle 12C RAC (Database)

- Management and application Oracle external table (Database)

- Nginx server security configuration (Server)

- Linux environmental performance data acquisition system (Linux)

- Ubuntu and Derivatives users install the latest KKEdit 0.0.31 (Linux)

- RedHat Linux 6 desktop installation (Linux)

- C # mobile side and PC-side data exchange (Database)

- Save the database data files into Oracle Learning (Database)

- Linux screen commonly commands (Linux)

- Linux Firewall Builder shorewall (Linux)

- How to configure Proftpd server on Fedora 22 (Server)

- Oracle JDK installation under Ubuntu Linux (Linux)

 
         
  Linux argument references and command substitution
     
  Add Date : 2017-01-08      
         
         
         
  In bash scripting, we often need to refer to variables and replacement orders for standard operation, now do a brief summary of their instructions.

Quote

Reference means the reference symbol string enclosed to prevent the special characters are interpreted shell scripts for other significance. Shielded special significance of special characters when referenced to be interpreted as literal meaning.

Reference symbol, name, meaning Description Table

Reference symbol Name Meaning Description
'' Said the single quotes full references or weak references, all references to characters; except a single quote character itself single quotes are interpreted as literal, single quotes do not have the function of a reference variable. . Literal single quote for holding all characters within the quotes, even if \ and carriage returns within quotes is no exception.
"" Double quotes or references section called strong references, references all characters except dollar sign ($), backquote ( `) and the backslash (\) in. That kept the dollar sign ($) in double quotes, the special meaning of anti-quotation marks ( ') and backslash (\) symbol, such as "$ variable name" represents a variable value substitution variable name. Use double quotes string variables can be prevented from dividing, reserved spaces in the variables.
`` Anti lead character shell symbol of the anti-cited interpreted as a system command
\ Backslash turn signifier, of special significance under the shield of a character, Linux commonly used special characters have $, *, `, +, ^, &, |," ,?

Example: [root @ CentOS6 tmp] # test = "x y z"; echo '$ test'

              [Root @ CentOS6 tmp] # $ test # will not turn back, only single quotation marks inside the literal meaning of its characters directly output
              [Root @ CentOS6 tmp] # test = "x y z"; echo $ test
              [Root @ CentOS6 tmp] # x y z # reference variable value, but does not retain spaces in the variables
              [Root @ CentOS6 tmp] # test = "x y z"; echo "$ test"
              [Root @ CentOS6 tmp] # x y z # reference variable value, and retain variable spaces
Note: The value of a variable can be used as part of a long string if it is at the end of a long string, you can directly reference, if at the beginning or the middle, should use curly braces enclose the variable.
        Example: [root @ CentOS6 tmp] # test = "xyz"; echo test $ test
              [Root @ CentOS6 tmp] # testxyz # normal output


              [Root @ CentOS6 tmp] # test = "xyz"; echo $ testtest
              [Root @ CentOS6 tmp] # # does not have any output, due to the reference value of the shell variable testtest can assign the variable is not defined

              [Root @ CentOS6 tmp] # test = "xyz"; echo $ {test} test
              [Root @ CentOS6 tmp] # xyztest # normal output

Command substitution
    Command substitution refers to the standard output of the command as a value to a variable, bash Shell defines two forms of substitute command, two forms of syntax is as follows:
    One way: `Linux command`
    Second way: $ (Linux command)
  
        Example: [root @ CentOS6 tmp] # echo `pwd`
              [Root @ CentOS6 tmp] # / tmp # pwd cited the results of a command and output

      Note: Although the $ () and the backtick command substitution is equivalent, however, $ () form of command substitution can be nested.
      bash Shell, the backquote with $ () there is a difference in dealing with the double backslash.
            [Root @ CentOS6 tmp] #echo \\
            [Root @ CentOS6 tmp] # \ # output escape
            [Root @ CentOS6 tmp] #echo `echo \\`
            [Root @ CentOS6 tmp] # # blank line is output
            [Root @ CentOS6 tmp] ## echo $ (echo \\)
            [Root @ CentOS6 tmp] # \ # single slash output
     
         
         
         
  More:      
 
- Object-C in the preparation of multi-parameter function parameter is omitted (Programming)
- Using the Linux VNC service (Server)
- Linux System Getting Started Learning: Change the name of the network interface on CentOS7 (Linux)
- About Samba certification process and permissions (Linux)
- Linux platform Oracle MySQL connection (Database)
- Formatting Java floating-point types (Programming)
- Ubuntu 12.04 installation DHCP Server (Server)
- Orabbix binding Python send graphical reports (Linux)
- Configuring Sublime Text Python runtime environment 2 (Linux)
- Use pg_basebackup build PostgreSQL streaming replication environment (Database)
- To create a secure network firewall with iptables Under Linux (Linux)
- ActiveMQ configuration Getting Started Tutorial (Server)
- Android shutdown (reboot) process (Programming)
- Docker build their own private warehouses (Linux)
- To install minimize RHEL / CentOS 7 (Linux)
- JavaScript basic types and type conversion (Programming)
- MySQL restart process can not be taken lightly (Database)
- CentOS7 install MySQL 5.5 (Database)
- File easier to compare tools under Linux (Linux)
- MongoDB data replication and data slices (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.