$ () and ' (anti-quote)In the bash shell, $ () and "(anti-quote) are used for command substitution.The so-called command substitution is similar to the variable substitution we learned in the fifth chapter, which is used to reorganize the command
If we define a variable as:File=/dir1/dir2/dir3/my.file.txtCan be replaced with ${} to get different values:${file#*/}: Delete the first/its left string: dir1/dir2/dir3/my.file.txt${file##*/}: Remove the last/and left string: my.file.txt${file#*.} :
1, read from file whileRead Line Do Echo "line= $line" Donefile. txt2, converts a string to an array, and iterates through STR="html, CSS, JavaScript, java, PHP, go, python"arr= (${str//,/ }) forIteminch${arr[@]} Do Echo "item= $item" Done3,
$ () and ' (anti-quote)In the bash shell, $ () and "(anti-quote) are used for command substitution.$ echo the last Sunday was $ (date-d "last Sunday" +%y-%m-%d)Get the date of the previous SundayThe reason for using $ ()1. "Easy to mix with" (single
$ () and ' (anti-quote)In the bash shell, $ () and "(anti-quote) are used for command substitution.The so-called command substitution is similar to the variable substitution we learned in the fifth chapter, which is used to reorganize the command
We all know that under Windows file encoding defaults to GBK or gb2312, but many users sometimes need to move files under Windows to the Linux system, so after the transfer is often garbled situation, this How to do? Next small series to introduce
The code is as follows
Copy Code
basedirforscriptself=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed script is: ${basedirforscriptself}"Orfullpath=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed
Today read a script file when there are some places do not understand, find an article to read some, feel good, keep down.Let's say we've defined a variable as:
Copy Code code as follows:
File=/dir1/dir2/dir3/my.file.txt
You
The meaning of shell variable $#,$@,$0,$1,$2 in Linux is explained:
Variable Description:
$$
The shell itself PID (ProcessID)
$!
The PID of the Shell's last running background process
$?
End code of the last command to run (return value)
$-
Flag
Http://blog.zol.com.cn/2322/article_2321763.html
$ () and ' (anti-quote)
In the bash shell, $ () and "(anti-quote) are used for command substitution.
The so-called command substitution is similar to the variable substitution we learned in the fifth
Suppose we define a variable as:Copy the Code code as follows:File=/dir1/dir2/dir3/my.file.txtDifferent values can be replaced with ${}, respectively:Copy the Code code as follows:${file#*/}: Delete the first/its left string:
A little bit of experience doing the front end knows that you can reduce the number of requests by merging small images.The earliest possible use of tools such as FW, PS to manually merge,The shortcomings of this way do not spit groove, low
Summary of shell 13, Summary of shell 13
We know that computer hardware resources, such as disks, I/O, and memory, are centrally managed by software. Such special software is often referred to as an operating system, windows builds its own interface
First look at the parameter Introduction
Format
Option File
Description
Introduced
-- Auto-generate-SQL
Auto-generate-SQL
Generate SQL statements automatically when they are not supplied in files
Shell variables and shell Variables
Suppose we define a variable:File =/dir1/dir2/dir3/my.file.txt
You can replace $ {} with different values:$ {File # */}: Delete the first/and its left string: dir1/dir2/dir3/my.file.txt$ {File ### */}: Delete the
Compile and install Redis and master-slave replication configuration in Linux
The installation and configuration of Redis is very simple, and Redis has been installed a long time ago. But I forgot some details when I installed it again these days.
The PHP version of batch Trojan and batch Trojan programs. Therefore, the hacker tool is a damage tool in the hands of hackers, and the maintenance webmaster is a correction tool.
The code is as follows:
Function gmfun ($ path = ".")
{
$ D = @ dir
Suppose we have defined a variable: file =/dir1/dir2/dir3/my.file.txt, which can be replaced with $ {} to get different values: $ {file #*/}: delete the first/and its left string: dir1/dir2/dir3/my.file.txt $ {file ##*/}: delete the last/and its
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.