分析代码的时候碰到如下一条awk语句:

style="color: #000000;">awk -v RS="\n\n" '/'"$b"'/{print $1}'```
1

首先,我们简化问题:

```<span style="color: #000000;"><span style="font-size: medium;">awk '/'"$b"'/{print $1}'</span></span>

我们必须清楚的是,

line**首先必须经过****shell****的解析**。```
1

shell在解析这条command line的时候,从左到右进行解析,单引号和双引号的匹配如下图所示:

[![12](http://miibotree.com/wp-content/uploads/2014/05/12.jpeg)](http://miibotree.com/?attachment_id=977)

第一对单引号其实是没有什么实质性的效果的。

中间这对双引号在shell的解析下将$b变成变量的值。如果b=&#8221;127.0.0.1&#8243;,则将被解析成字符串&#8221;127.0.0.1&#8243;。

后面那对单引号是为了将$1保持不变送入awk程序中。因为当前shell的$1(也就是调用当前这个shell程序的程序所传进来的参数)一般都是空。如果不加单引号,$1会被shell解析成空。而加了之后则把$1传入到awk程序中,在awk程序里面的$1就是第一个字段的意思。

最终传入到awk程序中的参数是这个样子的(如果b=”127.0.0.1”):

/127.0.0.1/{print $1}

1
2

所以说

awk ‘/‘“$b”‘/{print $1}’

1
2

等效于

awk /“$b”‘/{print $1}’

1
2

也等效于

awk ‘/‘$b’/{print $1}’
```

测试证明结果一致.

Finally I can use Chinese in Latex / linux.

first I want to show the code that works:

1
2
3
4
5
6
7
8
9
10
11
12
13
\documentclass[11pt]{article}
\usepackage{xeCJK}
\setCJKmainfont{SimHei} %SimHei is the Chinese font in my fc-list
\parindent 2em %段首缩进

\begin{document}
\section{举例}
\begin{verbatim}
标点。
\end{verbatim}

汉字Chinese数学$x=y$空格
\end{document}

this code has no error in my environment:

Fedora19 + texlive2013 + texmaker

compiled by Xelatex.

Be sure you have Chinese fonts under /user/share/fonts/

and use command:

1
2

fc-list : zh-cn

to see whether your fonts have been loaded into the cache.

And I found a paper which indroduce CTex, XeTex and XeCJK

http://www.360doc.com/content/11/1112/15/532901_163797486.shtml

 

 

I want to Latex support Chinese in Linux.

However, in windows there is CTEX project that can support Chinese almost perfectly.But Linux is rather difficult. And finally I found the below reference:

[http://linux-wiki.cn/wiki/zh-hans/LaTeX%E4%B8%AD%E6%96%87%E6%8E%92%E7%89%88%EF%BC%88%E4%BD%BF%E7%94%A8XeTeX%EF%BC%89

](http://linux-wiki.cn/wiki/zh-hans/LaTeX%E4%B8%AD%E6%96%87%E6%8E%92%E7%89%88%EF%BC%88%E4%BD%BF%E7%94%A8XeTeX%EF%BC%89)

Xelatex is included in Tex Live, and I copied the windows fonts to my fedora system.

However, when I use ctex,there is an error.

The only way is to to use xeCJK directly without use packege.

\documentclass[11pt]{article}
\usepackage[BoldFont,SlantFont,CJKsetspaces,CJKchecksingle]{xeCJK}
\setCJKmainfont[BoldFont=SimHei]{SimSun}
\setCJKmonofont{SimSun}% 设置缺省中文字体
\parindent 2em   %段首缩进

\begin{document}
\section{举例}
\begin{verbatim}
标点。
\end{verbatim}

汉字Chinese数学$x=y$空格
\end{document}

however, there are still some errors:

1. package CJKsetspaces not found.

! LaTeX Error: Unknown option CJKsetspaces&#8217; for packagefontspec’.

2.I can only use SimHei, when I want to use other fonts, error occurs.

I don’t know how to fix the problem……

Any one who could answer the problem please tell me.

Thank you.

 

Recently I am doing a PPT about penetration. And I want to introduce buffer overflow tech to my classmates. Especially I want to introduce the heap corruption tech.

Heap corruption in Windows is rather complicated.So I want to introduce the memory management in Linux. Here’re some references I’ve founded:

 

http://getpocket.com/a/read/571733519

http://etutorials.org/Networking/network+security+assessment/Chapter+13.+Application-Level+Risks/13.5+Heap+Overflows/

[http://www.win.tue.nl/~aeb/linux/hh/hh-11.html

](http://www.win.tue.nl/~aeb/linux/hh/hh-11.html)

 

Recently I’m learning a course: Compilers.

And after I have the classes and read the dragon book, I am going to use Lex in my linux OS.

here are some references:

阅读全文 »