-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
503 lines (238 loc) · 227 KB
/
search.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>C++ debug小技巧</title>
<link href="/2019/03/31/2019/cppdebug/"/>
<url>/2019/03/31/2019/cppdebug/</url>
<content type="html"><![CDATA[<p>hello everyone!<br>又到了春暖花开的季节<br>大一的工科孩子也开始了c++(c艹——破音)的学习(折磨)<br>这c++写起来就全都是bug啊<br>但是,有那么难吗<br>我不是什么c++大神,我就是单纯因为别人老是问我烦得慌<br>在我这的宗旨就是<br>自己的问题,自己解决,自己成长,才是最屌的<br>今天就教你们debug大法<br>书上绝口不提的编程小经验</p><a id="more"></a><p>跟我一起:</p><h1 id="Debug牛逼"><a href="#Debug牛逼" class="headerlink" title="Debug牛逼"></a>Debug牛逼</h1><p>不过刚开始先不debug<br>由于老师们建议大家使用vs<br>先来谈一谈vs建工程的问题<br>标准建工程步骤</p><blockquote><p>文件-新建-项目-win32控制台应用程序-填写名称-位置-下一步-空项目<br>在源文件上右键点击 添加-新建项-c++文件-填写名称-完成</p></blockquote><p>小吐槽:VS是以解决方案为项目单位的,所以比较麻烦,适合大工程</p><hr><p>下面我们正式开始debug<br>从案例中学习debug技巧<br>不谈错误是否低级,只谈如何迅速定位解决<br>先来看最简单的</p><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string"><iostream></span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>{</span><br><span class="line"> cot<<<span class="string">"hello world"</span><<<span class="built_in">endl</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure><p><img src="http://cdn.simonyang.club/2019318-cppdebug5.jpg" alt="2019318-cppdebug5"><br>第一种,名字错误<br>Debug 1:查找错误行<br>Debug 2:辨认错误类型<br>根据调试结果显示,错误为第四行,原因为未声明的标识符,意即<code>cot</code>没有声明,为什么没有声明呢,因为你写的是<code>cot</code>,而这个变量是未定义的<br>注意,c++所有的变量都应该定义后使用<br>类似的还有</p><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string"><iostream></span></span></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>{</span><br><span class="line"> <span class="built_in">cout</span><<<span class="string">"hello world"</span><<<span class="built_in">endl</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>第三行,<code>cout</code>、<code>endl</code>未定义,因为你没有<code>using namespace std;</code>,所以现在的命名空间没有<code>cout</code>、<code>endl</code><br><img src="http://cdn.simonyang.club/2019318-cppdebug7.jpg" alt="2019318-cppdebug7"></p><h1 id="IMPORTANT:"><a href="#IMPORTANT:" class="headerlink" title="IMPORTANT:"></a>IMPORTANT:</h1><p>不知道你发现没有,上面两例中的错误地方的下面都有红波浪线<br>在vs中,你编写程序的时候,如果出现了语法错误,红波浪线的出现就是在提示你,这一个地方错了,所以,写代码一定要敏感</p><hr><p>下面的辨认应该非常轻松了</p><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string"><iostream></span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>{</span><br><span class="line"> <span class="built_in">cout</span><<<span class="string">"hello world"</span><<<span class="built_in">endl</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>第二种 分号错误<br>debug结果显示第五行错误,信息显示<code>}</code>前缺少<code>;</code>,信息提示已经很充足了,加上分号就好<br>不过我们还是学到了一点经验,如果调试结果显示第五行错误,则第四行和第五行都有可能错误<br><img src="http://cdn.simonyang.club/2019318-cppdebug4.png" alt="2019318-cppdebug4"></p><hr><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string"><iostream></span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>{</span><br><span class="line"> <span class="built_in">cout</span><<<span class="string">"hello world"</span><<<span class="built_in">endl</span>; </span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>乍一看,没错误啊<br>第三种 符号错误<br>在有经验的人看来,英文<code>;</code>和中文<code>;</code>是有很大不一样的,但是初学者往往没有这种敏感性,看不出来,就发现不了错误<br>调试结果显示第五行有错误,中文<code>;</code>是未声明的,缺少英文<code>;</code><br>红波浪线也告诉了你错误在哪<br><img src="http://cdn.simonyang.club/2019318-cppdebug3.png" alt="2019318-cppdebug3"></p><h1 id="Debug总结:"><a href="#Debug总结:" class="headerlink" title="Debug总结:"></a>Debug总结:</h1><ol><li>仔细阅读调试结果</li><li>时刻注意红波浪线</li></ol><h1 id="其他常见错误:"><a href="#其他常见错误:" class="headerlink" title="其他常见错误:"></a>其他常见错误:</h1><ol><li>无错误地点,显示<code>main</code>已定义<br><img src="http://cdn.simonyang.club/2019318-cppdebug6.png" alt="2019318-cppdebug6"><br><code>_main</code> 已经在 <code>xx.obj</code> 中定义,提示你该项目下有多个<code>main</code>(一个项目不能有多个入口)</li><li>字符串和变量不清,即<code>N</code>和<code>'N'</code>不能分清(我遇到过)</li><li>拼写错误(常见)</li><li>符号错误,符号缺少或使用错误,使用英文输入法,使用IDE,注意所有的左括号都应该有对应的右括号</li><li>逻辑错误,变量使用错误,这个没办法,细心</li><li>逻辑错误,常见为<code>for</code>循环中更改i值,建议:在<code>for</code>循环中如何有意改变<code>i</code>值,将<code>i</code>值传给其他变量。逻辑错误是最难排查的错误,希望大家还是认真思考每一个循环每个变量都是什么值。</li></ol><h1 id="常见疑问:"><a href="#常见疑问:" class="headerlink" title="常见疑问:"></a>常见疑问:</h1><ol><li>乱码,vs左上侧 文件-高级保存选项 设置编码格式为<code>utf-8带签名</code>,另建议只要在学习编程,所有的程序文档格式均为<code>utf-8</code><br><img src="http://cdn.simonyang.club/2019318-cppdebug2.png" alt="2019318-cppdebug2"></li><li>闪现,vs左上侧 调试-开始执行不调试(Ctrl+F5)或者在<code>main</code>里最后加一句 <code>system("pause");</code>,或者<code>cin.get();</code><br>(有兴趣的同学可以试一下调试里的逐语句 逐过程)<br><img src="http://cdn.simonyang.club/2019318-cppdebug1.png" alt="2019318-cppdebug1"></li></ol><p>总的来说,建议以下:</p><ol><li>使用IDE,使用大括号和缩进</li><li>查看调试结果,阅读调试信息</li><li>时刻注意使用英文符号,好好学习英语(像vs这样对中文这么友好的IDE不多了)</li></ol><p>小提醒:<br>想提问请发全部的程序图截图和执行情况截图<br>正确提问方法,下一篇推送见<br>你还遇见过什么奇葩错误,后台留言告诉我吧</p>]]></content>
<categories>
<category> C++ </category>
</categories>
</entry>
<entry>
<title>C++二级提醒</title>
<link href="/2019/03/31/2019/Kindreminder/"/>
<url>/2019/03/31/2019/Kindreminder/</url>
<content type="html"><![CDATA[<p>友情提醒:<br>有些人呐,学了一个学期的计算机程序设计基础,就自以为掌握了cpp大法,于是看到了计算机二级有cpp,于是那么一报<br>等到快考试临阵磨枪的时候才发现整张卷子都是什么构造函数 析构函数 private public 友元函数,然后去考,挂了<br>所以划重点,没认真学过cpp面向对象部分的同学不要抱cpp的二级,如果对指针数组掌握较好想混个二级证可以去报c的</p>]]></content>
<categories>
<category> C++ </category>
</categories>
</entry>
<entry>
<title>问问题竟然也有方法论</title>
<link href="/2019/03/31/2019/howtoaskquestion/"/>
<url>/2019/03/31/2019/howtoaskquestion/</url>
<content type="html"><![CDATA[<p>这篇推文的出现原因是<br>长期帮助别人解决问题的帮助人对需要帮助的人的一些好的建议<br>这些建议有助于更有效地沟通和提升解决问题的效率</p><a id="more"></a><p>你已经开始学习程序设计了<br>你已经开始写一些代码并且还获得附赠的bug了</p><p>众所周知,解决bug是提升能力的好机会<br>遇到每一个bug都认真解决才能在未来写更少的bug<br>那么<br>如何去更好的解决你的程序bug来提升呢<br>First<br>你应该仔细查看你的程序异常返回信息<br>几乎所有的程序设计语言都会在报错的时候附带一些信息<br>这些信息涵盖了涵盖了你的出错行,出错原因<br>注意,不要因为他是英文而不愿意看<br>实话告诉你,你早晚要看</p><p>Second<br>异常返回信息看了,但是还是解决不了<br>搜索,成千上万的人在学习编程,你在初期所遇到的错误百分之百在网络上有答案<br>你只需要准确简短的描述你的状况,<br>例如: python3中range返回的对象索引取值报错<br>然后在无数的返回结果中迅速挑选能够解决你问题的答案<br>不要怕试错,这也是一种学习的过程<br>我推荐谷歌,但是国内百度也还可以接受<br>如果英文良好可以尝试去stackoverflow和github寻找答案</p><p>有一点要说的是,有些人在长时间的搜索后还没有解决问题会怀疑,是不是该编程语言的编写有问题<br>很遗憾的告诉你,这种概率几乎为0</p><p>Third<br>如果百度也未能成功的帮助到你<br>就到了最不推荐也是最后一个选项<br>求助他人<br>但是,问问题也要讲究方法,这就是我写这篇文章的缘由</p><ol><li>帮助人希望被帮助人能够独立进行以上的所有步骤以及进行必要的思考<br>这会极大的提升帮助人的好感</li><li>帮助人希望被帮助人能够提供清晰有效的信息,例如,程序的目的是什么,你的期望输出是什么样子,全部错误代码的清晰图像,<br>执行结果的清晰图像,代码运行环境版本信息<br>这将有助于帮助人判断到底是哪里出了问题</li></ol><p>一个例子是,我在搭建服务器的时候遇到了一个问题,花费了两天都未能解决,<br>无奈在python大群里咨询,一个人私聊要了我的服务器帮我改好了,我给他发了五元红包,然后他没要,叮嘱我记得修改服务器密码</p><p>最后还有小建议是</p><ol><li>如果双方在网上交流且关系不熟,切忌提太过于空泛的问题,例如,python如何学习,这类问题难于详解且让人觉得很伸手党</li><li>女生找个男朋友以上问题均不存在</li></ol><p>点击阅读原文查看github上广泛传阅的 <a href="https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md" target="_blank" rel="noopener">提问的智慧</a></p>]]></content>
<categories>
<category> 方法论 </category>
</categories>
</entry>
<entry>
<title>Python复习(一)</title>
<link href="/2018/11/27/2018/python-basic-review-1/"/>
<url>/2018/11/27/2018/python-basic-review-1/</url>
<content type="html"><![CDATA[<blockquote><p>本文默认python3<br>写代码时应使用英文符号,utf-8编码</p></blockquote><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#看一下保留关键字,保留字不能用作变量名</span></span><br><span class="line"><span class="keyword">import</span> keyword</span><br><span class="line">print(keyword.kwlist)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#看一下python命令的位置</span></span><br><span class="line"><span class="keyword">import</span> sys</span><br><span class="line">print(sys.executable)</span><br><span class="line">print(__name__)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">C:\ProgramData\Anaconda3\python.exe</span><br><span class="line">__main__</span><br></pre></td></tr></table></figure><blockquote><p><code>__name__</code>在运行文件中为<code>__main__</code>,在导入时为模块名</p></blockquote><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 单行注释由一个井号开头。</span></span><br><span class="line"><span class="string">""" </span></span><br><span class="line"><span class="string"> 三个双引号之间可以写多行字符串,</span></span><br><span class="line"><span class="string"> 通常用来写注释。</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">'''</span></span><br><span class="line"><span class="string"> 单引号也可以。</span></span><br><span class="line"><span class="string">'''</span></span><br><span class="line"><span class="comment">#使用print可以输出任何东西</span></span><br><span class="line">print(<span class="number">1</span>)</span><br><span class="line">print(<span class="number">1.0</span>)</span><br><span class="line">print(<span class="number">1</span>+<span class="number">1j</span>,<span class="number">2</span>+<span class="number">2J</span>) <span class="comment">#复数</span></span><br><span class="line">print(<span class="number">0b100</span>) <span class="comment">#二进制</span></span><br><span class="line">print(<span class="number">0o100</span>) <span class="comment">#八进制</span></span><br><span class="line">print(<span class="number">0x100</span>) <span class="comment">#十六进制</span></span><br><span class="line">print(<span class="number">1.35324e13</span>,<span class="number">5.4e-4</span>) <span class="comment">#科学计数法</span></span><br><span class="line">print(<span class="string">"hello world"</span>) <span class="comment">#双引号创建字符串</span></span><br><span class="line">print(<span class="string">'hello'</span>,<span class="string">'world'</span>) <span class="comment">#单引号也ok</span></span><br><span class="line">print(<span class="string">'hello'</span>,<span class="string">'world'</span>,sep=<span class="string">','</span>)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">1</span><br><span class="line">1.0</span><br><span class="line">(1+1j) (2+2j)</span><br><span class="line">4</span><br><span class="line">64</span><br><span class="line">256</span><br><span class="line">13532400000000.0 0.00054</span><br><span class="line">hello world</span><br><span class="line">hello world</span><br><span class="line">hello,world</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">print(<span class="number">1</span>+\</span><br><span class="line"> <span class="number">2</span>+\</span><br><span class="line"> <span class="number">3</span>) <span class="comment">#跨行</span></span><br><span class="line">print(<span class="string">"""</span></span><br><span class="line"><span class="string">hello</span></span><br><span class="line"><span class="string">world</span></span><br><span class="line"><span class="string">"""</span>)</span><br><span class="line">print(<span class="string">'''</span></span><br><span class="line"><span class="string">hello wor</span></span><br><span class="line"><span class="string">ld</span></span><br><span class="line"><span class="string">'''</span>)</span><br><span class="line">print(help(<span class="keyword">print</span>))</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">6</span><br><span class="line"></span><br><span class="line">hello</span><br><span class="line">world</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">hello wor</span><br><span class="line">ld</span><br><span class="line"></span><br><span class="line">Help on built-in function print in module builtins:</span><br><span class="line"></span><br><span class="line">print(...)</span><br><span class="line"> print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)</span><br><span class="line"> </span><br><span class="line"> Prints the values to a stream, or to sys.stdout by default.</span><br><span class="line"> Optional keyword arguments:</span><br><span class="line"> file: a file-like object (stream); defaults to the current sys.stdout.</span><br><span class="line"> sep: string inserted between values, default a space.</span><br><span class="line"> end: string appended after the last value, default a newline.</span><br><span class="line"> flush: whether to forcibly flush the stream.</span><br><span class="line"></span><br><span class="line">None</span><br></pre></td></tr></table></figure><blockquote><p>help获取print函数的说明</p></blockquote><p>python repl</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span>a=input(<span class="string">"please enter your name:"</span>) <span class="comment">#input返回的永远是字符串</span></span><br><span class="line">please enter your name:simon</span><br><span class="line"><span class="meta">>>> </span>print(a)</span><br><span class="line">simon</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 赋值,python区分大小写</span></span><br><span class="line">a = <span class="number">1</span> </span><br><span class="line">print(a)</span><br><span class="line">a = b = c = <span class="string">'hello'</span></span><br><span class="line">print(a,b,c)</span><br><span class="line">a=<span class="string">'some'</span>;b=<span class="string">'boys'</span></span><br><span class="line">print(a,b)</span><br><span class="line">a, b, c = <span class="number">1</span>, <span class="number">2</span>, <span class="string">"runoob"</span></span><br><span class="line">print(a,b,c)</span><br><span class="line"><span class="comment"># 删除这个值</span></span><br><span class="line"><span class="keyword">del</span> a</span><br><span class="line">print(a) <span class="comment">#traceback即错误</span></span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">1</span><br><span class="line">hello hello hello</span><br><span class="line">some boys</span><br><span class="line">1 2 runoob</span><br><span class="line">Traceback (most recent call last):</span><br><span class="line"> File "C:\Personal Files\Blog\my\share\tj2jzutfm_code_chunk.py", line 12, in <module></span><br><span class="line"> print(a) </span><br><span class="line">NameError: name 'a' is not defined</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 布尔值</span></span><br><span class="line">print(<span class="literal">True</span>,<span class="literal">False</span>,sep=<span class="string">','</span>)</span><br><span class="line">print(<span class="keyword">not</span> <span class="literal">True</span>)</span><br><span class="line">print(<span class="literal">True</span> <span class="keyword">and</span> <span class="literal">False</span>)</span><br><span class="line">print(<span class="literal">True</span> <span class="keyword">or</span> <span class="literal">False</span> )</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">True,False</span><br><span class="line">False</span><br><span class="line">False</span><br><span class="line">True</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#判断</span></span><br><span class="line">print(<span class="number">2</span> == <span class="number">1</span>,<span class="number">2</span> != <span class="number">1</span>,<span class="number">1</span> < <span class="number">10</span>,<span class="number">2</span> >= <span class="number">2</span> )</span><br><span class="line">print(<span class="number">1</span> < <span class="number">2</span> < <span class="number">3</span>,<span class="number">2</span> < <span class="number">3</span> < <span class="number">2</span>)</span><br><span class="line"><span class="comment">#None、0 以及各种空的集合在判断时都是 False </span></span><br><span class="line">print(bool(<span class="number">0</span>),bool(<span class="string">''</span>),bool(()),bool([]),bool({}))</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">False True True True</span><br><span class="line">True False</span><br><span class="line">False False False False False</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 运算</span></span><br><span class="line">print(<span class="number">1</span> + <span class="number">1</span>) </span><br><span class="line">print(<span class="number">8</span> - <span class="number">1</span>)</span><br><span class="line">print(<span class="number">10</span> * <span class="number">2</span>) </span><br><span class="line">print(<span class="number">35</span> / <span class="number">5</span>)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">2</span><br><span class="line">7</span><br><span class="line">20</span><br><span class="line">7.0</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment"># 除法有一点棘手。</span></span><br><span class="line"><span class="comment"># 对于整数除法来说,/和你期望的一样,但是//(地板除)会自动取整。</span></span><br><span class="line">print(<span class="number">5</span> / <span class="number">2</span>) </span><br><span class="line">print(<span class="number">5</span> // <span class="number">2</span>)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">2.5</span><br><span class="line">2</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">print(<span class="number">11.2</span> / <span class="number">4.5</span>) </span><br><span class="line">print(<span class="number">11.5</span> // <span class="number">4.5</span>)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">2.488888888888889</span><br><span class="line">2.0</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#取余</span></span><br><span class="line">print(<span class="number">22</span> % <span class="number">7</span>)</span><br><span class="line">print(<span class="number">3.6</span> % <span class="number">1.5</span>) </span><br><span class="line"><span class="comment"># 使用小括号来强制计算的优先顺序</span></span><br><span class="line">print((<span class="number">1</span> + <span class="number">3</span>) * <span class="number">2</span>) </span><br><span class="line"><span class="comment">#幂</span></span><br><span class="line">print(<span class="number">3</span>**<span class="number">5</span>)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">1</span><br><span class="line">0.6000000000000001 #浮点运算有误差,最后有方法避免</span><br><span class="line">8</span><br><span class="line">243</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#增量赋值</span></span><br><span class="line">a = <span class="number">1</span></span><br><span class="line">a += <span class="number">2</span></span><br><span class="line">print(a)</span><br><span class="line">a *= <span class="number">5</span></span><br><span class="line">print(a)</span><br><span class="line">a %= <span class="number">7</span></span><br><span class="line">print(a)</span><br><span class="line"><span class="comment">#没有a++</span></span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">3</span><br><span class="line">15</span><br><span class="line">1</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#字符串运算</span></span><br><span class="line">print(<span class="string">'hello '</span>*<span class="number">4</span>)</span><br><span class="line">print(<span class="string">'hello'</span>+<span class="string">' '</span>+<span class="string">'world'</span>) <span class="comment">#字符串也可以相加</span></span><br><span class="line">print(<span class="string">"This is a string"</span>[<span class="number">5</span>])</span><br><span class="line">print(<span class="string">"This is a string"</span>[<span class="number">2</span>:<span class="number">7</span>]) <span class="comment">#左包含右不包含</span></span><br><span class="line">print(<span class="string">" "</span> <span class="keyword">in</span> <span class="string">"This is a string"</span>)</span><br><span class="line">a = <span class="string">"simon yang"</span></span><br><span class="line"><span class="keyword">del</span> a[<span class="number">1</span>:<span class="number">5</span>] <span class="comment">#字符串不可变</span></span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">hello hello hello hello </span><br><span class="line">hello world</span><br><span class="line">i</span><br><span class="line">is is</span><br><span class="line">True</span><br><span class="line">Traceback (most recent call last):</span><br><span class="line"> File "C:\Personal Files\Blog\my\share\cxcl2b3bs_code_chunk.py", line 8, in <module></span><br><span class="line"> del a[1:5] </span><br><span class="line">TypeError: 'str' object does not support item deletion</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#内置对象</span></span><br><span class="line">print(<span class="literal">None</span>)</span><br><span class="line"><span class="comment">#`is` 操作符用于比较两个对象的地址是否相同</span></span><br><span class="line">print(<span class="literal">None</span> <span class="keyword">is</span> <span class="literal">None</span>)</span><br><span class="line">print(<span class="string">""</span> <span class="keyword">is</span> <span class="literal">None</span>)</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">None</span><br><span class="line">True</span><br><span class="line">False</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#继续字符串,转义</span></span><br><span class="line">print(<span class="string">"i'm simon yang"</span>)</span><br><span class="line">print(<span class="string">'i\'m simon yang'</span>)</span><br><span class="line">print(<span class="string">" \\ \n \""</span>)</span><br><span class="line">print(<span class="string">r" \\ \n \""</span>) <span class="comment">#r表示原始字符串</span></span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">i'm simon yang</span><br><span class="line">i'm simon yang</span><br><span class="line"> \ </span><br><span class="line"> "</span><br><span class="line"> \\ \n \"</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#继续字符串,格式化字符串</span></span><br><span class="line">print(<span class="string">"%s can be %s"</span> % (<span class="string">"strings"</span>, <span class="string">"interpolated"</span>))</span><br><span class="line">print(<span class="string">'Hi, %s, you have $%d.'</span> % (<span class="string">'Simon'</span>, <span class="number">1000000</span>))</span><br><span class="line">print(<span class="string">'%.2f'</span> % <span class="number">3.1415926</span>)</span><br><span class="line">print(<span class="string">"{0} can be {1}"</span>.format(<span class="string">"strings"</span>, <span class="string">"formatted"</span>))</span><br><span class="line">print(<span class="string">"{name} wants to eat {food}"</span>.format(name=<span class="string">"Bob"</span>, food=<span class="string">"lasagna"</span>))</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">strings can be interpolated</span><br><span class="line">Hi, Simon, you have $1000000.</span><br><span class="line">3.14</span><br><span class="line">strings can be formatted</span><br><span class="line">Bob wants to eat lasagna</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#字符串的一些方法</span></span><br><span class="line">print(<span class="string">"simon yang"</span>.capitalize())</span><br><span class="line">print(<span class="string">"simon yang"</span>.split(<span class="string">" "</span>))</span><br><span class="line">print(<span class="string">"simon yang"</span>.endswith(<span class="string">"yang"</span>))</span><br><span class="line">print(dir(<span class="string">"simon yang"</span>)) <span class="comment">#查看所有方法</span></span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Simon yang</span><br><span class="line">['simon', 'yang']</span><br><span class="line">True</span><br><span class="line">['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#一些内置函数</span></span><br><span class="line">print(abs(<span class="number">-3</span>),abs(<span class="number">3</span>+<span class="number">4j</span>),int(<span class="number">-5.6</span>),float(<span class="number">4</span>),complex(<span class="number">-3</span>,<span class="number">4</span>))</span><br><span class="line">print(divmod(<span class="number">7</span>,<span class="number">3</span>),pow(<span class="number">2</span>,<span class="number">5</span>))</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">3 5.0 -5 4.0 (-3+4j)</span><br><span class="line">(2, 1) 32</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#类型转换</span></span><br><span class="line">print(int(<span class="string">'-8'</span>),float(<span class="string">"43.35"</span>),repr(str(<span class="number">3</span>))) <span class="comment">#repr函数会显示原始形式</span></span><br><span class="line">print(repr(str([<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>])),list(<span class="string">'234'</span>),dict(key=<span class="string">'value'</span>))</span><br><span class="line">print(<span class="number">3.6</span> % <span class="number">1.5</span>) <span class="comment">#不精准</span></span><br><span class="line"><span class="keyword">import</span> decimal</span><br><span class="line">print(decimal.Decimal(<span class="string">'3.6'</span>) % decimal.Decimal(<span class="string">'1.5'</span>)) <span class="comment">#精准</span></span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">-8 43.35 '3'</span><br><span class="line">'[1, 2, 3]' ['2', '3', '4'] {'key': 'value'}</span><br><span class="line">0.6000000000000001</span><br><span class="line">0.6</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#分数</span></span><br><span class="line"><span class="keyword">import</span> fractions</span><br><span class="line">print(fractions.Fraction(<span class="number">4</span>,<span class="number">3</span>) / fractions.Fraction(<span class="number">3</span>/<span class="number">2</span>))</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">8/9</span><br></pre></td></tr></table></figure><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#字符串编码</span></span><br><span class="line">x = <span class="string">b'ABC'</span> <span class="comment">#ascii</span></span><br><span class="line">x = <span class="string">"ABC"</span></span><br><span class="line">print(<span class="string">'中文'</span>.encode(<span class="string">'utf-8'</span>))</span><br><span class="line">print(<span class="string">b'\xe4\xb8\xad\xe6\x96\x87'</span>.decode(<span class="string">'utf-8'</span>))</span><br><span class="line">print(len(<span class="string">'ABC'</span>))</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">b'\xe4\xb8\xad\xe6\x96\x87'</span><br><span class="line">中文</span><br><span class="line">3</span><br></pre></td></tr></table></figure><blockquote><p>repl中_可以获得上一个值,help进入帮助</p></blockquote>]]></content>
<categories>
<category> python </category>
</categories>
</entry>
<entry>
<title>Hexo博客搭建</title>
<link href="/2018/11/27/2018/hexo_blog/"/>
<url>/2018/11/27/2018/hexo_blog/</url>
<content type="html"><![CDATA[<p>Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。</p><blockquote><p>本文默认操作系统为Windows x64<br>Mac用户安装node和git时选择对应版本即可<br>sssimonyang是我的用户名<br>部分操作可能有warning出现,无error即可</p></blockquote><h1 id="安装Node-js和Git"><a href="#安装Node-js和Git" class="headerlink" title="安装Node.js和Git"></a>安装Node.js和Git</h1><ul><li>Node.js <a href="https://nodejs.org/en/" target="_blank" rel="noopener">https://nodejs.org/en/</a> 选择LTS版本,然后安装,一路默认即可</li><li>Git <a href="https://git-scm.com/downloads" target="_blank" rel="noopener">https://git-scm.com/downloads</a> 点击windows下载,然后安装,一路默认即可</li></ul><p>验证一下安装成功没有<br>打开命令行(windows用户 win+r 然后输入 cmd 回车)<br>在cmd里</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\sssimonyang>node -v</span><br><span class="line">v8.9.3</span><br><span class="line">C:\Users\sssimonyang>git --version</span><br><span class="line">git version 2.15.0.windows.1</span><br></pre></td></tr></table></figure><blockquote><p>你们的版本肯定比我的新,无错误即可</p></blockquote><p>然后继续,下文中<>内容需替换</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\sssimonyang>git config --global user.name <your username></span><br><span class="line">C:\Users\sssimonyang>git config --global user.email <your email></span><br><span class="line">C:\Users\sssimonyang>npm install -g hexo</span><br></pre></td></tr></table></figure><p>切换文件夹</p><ul><li><p><code>cd <folder></code> 切换到你想放置博客的文件夹,cmd中切换盘符的命令为 <code>D:</code> 然后回车<br>比如我想放在<code>E:\MyFiles</code>下面</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\sssimonyang>E:</span><br><span class="line">E:\>cd MyFiles</span><br><span class="line">E:\MyFiles></span><br></pre></td></tr></table></figure></li><li><p>也可以在文件资源管理器的对应文件夹页面按住shift同时点击右键打开powershell,powershell是cmd的增强版,对这篇文章而言两者相同</p></li></ul><p>cmd</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">E:\MyFiles>hexo init blog #这里会新建一个文件夹,blog名字可以随意更换</span><br><span class="line">E:\MyFiles>cd blog</span><br><span class="line">E:\MyFiles\blog>npm install</span><br><span class="line">E:\MyFiles\blog>hexo server</span><br></pre></td></tr></table></figure><p>打开 <a href="http://localhost:4000/" target="_blank" rel="noopener">http://localhost:4000/</a> 有页面即成功</p><h1 id="注册Github"><a href="#注册Github" class="headerlink" title="注册Github"></a>注册Github</h1><p><a href="https://github.com/" target="_blank" rel="noopener">https://github.com/</a> 注册然后对应邮箱激活,一定要激活</p><blockquote><p>取个好的用户名,不要有大写、符号、空格等(有的话后续可能出现一些问题) </p></blockquote><p>然后点击Start a project新建一个Repository(仓库)<br>Repository Name处填写<code><your username>.github.io</code>,此处<code><your username></code>和你的github用户名必须一模一样</p><blockquote><p>我的github用户名是sssimonyang,所以Repository Name就是<code>sssimonyang.github.io</code>,博客地址也是这个</p></blockquote><p>Description处选填,勾选Pubic,不勾选Readme<br>点击Create新建<br><code>https://github.com/<your username>/<your username>.github.io.git</code> 就是你的Repository地址</p><h1 id="向Repository传入内容"><a href="#向Repository传入内容" class="headerlink" title="向Repository传入内容"></a>向Repository传入内容</h1><p>打开<code>E:\MyFiles\blog\_config.yml</code><br>将deploy处更改如下</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line"> type: git</span><br><span class="line"> repository: https://github.com/<your username>/<your username>.github.io.git</span><br><span class="line"> branch: master</span><br></pre></td></tr></table></figure><blockquote><p>注意配置项的冒号后面要用空格隔开</p></blockquote><p>cmd</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">E:\MyFiles\blog>npm install hexo-deployer-git --save</span><br><span class="line">E:\MyFiles\blog>hexo d -g</span><br></pre></td></tr></table></figure><blockquote><p>中途会出现登陆git的页面</p></blockquote><p>最后出现<code>INFO Deploy done: git</code>即成功</p><h1 id="配置github-io"><a href="#配置github-io" class="headerlink" title="配置github.io"></a>配置github.io</h1><p>登陆github,进入<code><your username>.github.io</code> 仓库<br>仓库如果有内容说明上一步的<code>hexo d -g</code>确实成功了,不然的话重回上一步检查deploy<br>点击右侧Settings,拉到下面GitHub Pages,Source处选择master branch,然后save,保存后页面会变成<br><img src="http://cdn.simonyang.club/20181127-QQ%E6%88%AA%E5%9B%BE20181127192542.jpg" alt="20181127-QQ截图20181127192542"><br>表明你的网站就是<code>https://<your username>.github.io</code><br>打开 <code>https://<your username>.github.io</code> 即是博客页面,如果没有页面的话稍等片刻</p><h1 id="写博客,维护博客"><a href="#写博客,维护博客" class="headerlink" title="写博客,维护博客"></a>写博客,维护博客</h1><p>hexo 文档 <a href="https://hexo.io/zh-cn/docs/" target="_blank" rel="noopener">https://hexo.io/zh-cn/docs/</a><br>新建博客</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">E:\MyFiles\blog>hexo new <blog name></span><br></pre></td></tr></table></figure><p><code>E:\MyFiles\blog\source\_posts\<blog name>.md</code> 即为博客文章<br>注意文章的编码应为utf-8<br>博客采用markdown语法<br>Markdown 文档 <a href="https://markdown-zh.readthedocs.io/en/latest/" target="_blank" rel="noopener">https://markdown-zh.readthedocs.io/en/latest/</a></p><h1 id="换用ssh协议免登陆"><a href="#换用ssh协议免登陆" class="headerlink" title="换用ssh协议免登陆"></a>换用ssh协议免登陆</h1><p>不想隔一段时间<code>hexo d -g</code>就要重新登陆,如何实现<br>cmd</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\Si tu m'aimes>ssh-keygen -t rsa -C "<your email>"</span><br></pre></td></tr></table></figure><blockquote><p>一路回车</p></blockquote><p>看一下你的提示信息,在主目录下有文件<code>~/.ssh/id_rsa.pub</code>生成<br>我的文件路径是<code>C:\Users\Si tu m'aimes\.ssh\id_rsa.pub</code><br>用记事本打开<code>id_rsa.pub</code>,复制内容<br>登陆github,点击右上角头像进入settings<br>选择SSH and GPG keys,选择new SSH key<br>Title随便填,key内粘贴你的id_rsa.pub文件内容,点击Add保存<br>cmd</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\Si tu m'aimes>ssh -T [email protected] #输入yes</span><br></pre></td></tr></table></figure><p>将deploy处更改为</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line"> type: git</span><br><span class="line"> repository: [email protected]:<your username>/<your username>.github.io.git</span><br><span class="line"> branch: master</span><br></pre></td></tr></table></figure><p>然后在cmd中</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\Si tu m'aimes>hexo d -g</span><br></pre></td></tr></table></figure><p>这样便不再需要每次git时登陆</p><blockquote><p>这些操作的目的是为了使用ssh协议将博客推送到github</p></blockquote><h1 id="换一个模板"><a href="#换一个模板" class="headerlink" title="换一个模板"></a>换一个模板</h1><p>百度寻找模板,按照页面提示要求<code>git clone</code>然后更改_config.yml<br><code>theme: <your theme name></code></p><h1 id="将博客放到服务器上"><a href="#将博客放到服务器上" class="headerlink" title="将博客放到服务器上"></a>将博客放到服务器上</h1><p>安装git</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y install git</span><br></pre></td></tr></table></figure><p>在home下创建一个git仓库</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">cd /home</span><br><span class="line">mkdir git</span><br><span class="line">cd git</span><br><span class="line">git init --bare hexo.git</span><br></pre></td></tr></table></figure><p>在hooks下面创建一个post-receive</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /home/git/hexo.git/hooks/post-receive</span><br></pre></td></tr></table></figure><p>post-receive内容更改为</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">#!/bin/sh</span><br><span class="line">git --work-tree=/data/hexo --git-dir=/home/git/hexo.git checkout -f</span><br></pre></td></tr></table></figure><p>接着更改<code>post-receive</code>的权限,使他可执行,创建博客目录</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chmod 755 /home/git/hexo.git/hooks/post-receive</span><br><span class="line">mkdir /data/hexo</span><br></pre></td></tr></table></figure><p>找到你的ssh key,在我的电脑上在这</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\Si tu m'aimes\.ssh\id_rsa.pub</span><br></pre></td></tr></table></figure><p>复制文本内容,然后在服务器上</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /root/.ssh/authorized_keys</span><br></pre></td></tr></table></figure><p>粘贴 保存<br>然后在我的电脑上,cmd中</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\Si tu m'aimes>ssh root@<your server ip> #输入yes</span><br></pre></td></tr></table></figure><p>最后更改_config.yml内容<br>当有两个deploy时</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">- type: git</span><br><span class="line"> repository: [email protected]:<your username>/<your username>.github.io.git</span><br><span class="line"> branch: master</span><br><span class="line">- type: git</span><br><span class="line"> repository: root@<your server ip>:/home/git/hexo.git</span><br><span class="line"> branch: master</span><br></pre></td></tr></table></figure><p><code>hexo d -g</code>结束,Bingo!</p><blockquote><p>有问题请留言</p></blockquote>]]></content>
<tags>
<tag> share </tag>
</tags>
</entry>
<entry>
<title>linux shell 脚本攻略</title>
<link href="/2018/11/26/2018/linux-shell/"/>
<url>/2018/11/26/2018/linux-shell/</url>
<content type="html"><![CDATA[<p>因为<code>linux</code>和<code>shell</code>的学习对于生物信息来说很重要,而且平常使用机会较少<br>所以还是决定重读一遍《linux shell脚本攻略》并写下笔记<br>笔记真实代码输入输出自行理解</p><blockquote><p>无特殊说明均在linux centos环境下运行得出<br>书是从交大图书馆借的,第二版,感觉不适合新手看</p></blockquote><h1 id="小试牛刀"><a href="#小试牛刀" class="headerlink" title="小试牛刀"></a>小试牛刀</h1><h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><blockquote><p>shell中的注释开头为<code>#</code><br><code>~</code>表示主目录<br>每当一个新shell生成时,都会执行<code>~/.bashrc</code> </p></blockquote><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[root@VM_0_14_centos ~]# pwd #linux centos root下</span><br><span class="line">/root</span><br><span class="line">vip7@VM-0-15-ubuntu:~$ pwd #linux ubuntu 非root下</span><br><span class="line">/home/vip7</span><br></pre></td></tr></table></figure><blockquote><p>root开头为<code>#</code> 非root开头为<code>$</code> <code>@</code>前为用户名后为主机名<br>非root用户使用<code>sudo <command> <arguments></code>执行root命令<br>shell脚本通常起始为 <code>#!/bin/bash</code></p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"> echo echo hello > hello.sh</span><br><span class="line"><span class="meta">></span> cat hello.sh</span><br><span class="line">echo hello</span><br><span class="line"><span class="meta">></span> bash hello.sh</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> ./hello.sh</span><br><span class="line">-bash: ./hello.sh: Permission denied</span><br><span class="line"><span class="meta">></span> ls -l</span><br><span class="line">total 12</span><br><span class="line">-rw-r--r-- 1 root root 11 Jul 24 09:36 hello.sh</span><br><span class="line"><span class="meta">></span> chmod a+x hello.sh</span><br><span class="line"><span class="meta">></span> ./hello.sh</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> /root/hello.sh</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> ls -l</span><br><span class="line">total 12</span><br><span class="line">-rwxr-xr-x 1 root root 11 Jul 24 09:36 hello.sh</span><br></pre></td></tr></table></figure><h2 id="打印"><a href="#打印" class="headerlink" title="打印"></a>打印</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo hello</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> echo hello world</span><br><span class="line">hello world</span><br><span class="line"><span class="meta">></span> echo 'hello world'</span><br><span class="line">hello world</span><br><span class="line"><span class="meta">></span> echo "hello world"</span><br><span class="line">hello world</span><br><span class="line"><span class="meta">></span> echo "hello world !"</span><br><span class="line">-bash: !": event not found</span><br><span class="line"><span class="meta">></span> echo 'hello world !'</span><br><span class="line">hello world !</span><br><span class="line"><span class="meta">></span> echo "hello world \!"</span><br><span class="line">hello world \!</span><br><span class="line"><span class="meta">></span> echo "hello world\$"</span><br><span class="line">hello world$</span><br></pre></td></tr></table></figure><blockquote><p>ubuntu稍有区别</p></blockquote><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">vip7@VM-0-15-ubuntu:~$ echo "hello world !"</span><br><span class="line">hello world !</span><br><span class="line">vip7@VM-0-15-ubuntu:~$ echo 'hello world !'</span><br><span class="line">hello world !</span><br><span class="line">vip7@VM-0-15-ubuntu:~$ echo "hello world\$"</span><br><span class="line">hello world$</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> printf "%-5s %-10s %-4.2f\n" 1 simon 40.3524 </span><br><span class="line">1 simon 40.35</span><br><span class="line"><span class="meta">></span> echo -n hello;echo hello </span><br><span class="line">hellohello</span><br><span class="line"><span class="meta">></span> echo -e "1\t2\t3" </span><br><span class="line">123</span><br></pre></td></tr></table></figure><h2 id="环境变量和变量"><a href="#环境变量和变量" class="headerlink" title="环境变量和变量"></a>环境变量和变量</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> pgrep ls #获取程序的PID</span><br><span class="line">464</span><br><span class="line"><span class="meta">></span> cat /proc/464/environ</span><br><span class="line">LANG=en_USUTF-8PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binHOME=/rootLOGNAME=rootUSER=rootSHELL=/bin/sh #中间用</span><br><span class="line"><span class="meta">></span> cat /proc/464/environ | tr '\0' '\n'</span><br><span class="line">LANG=en_US.UTF-8</span><br><span class="line">PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin</span><br><span class="line">HOME=/root</span><br><span class="line">LOGNAME=root</span><br><span class="line">USER=root</span><br><span class="line">SHELL=/bin/sh</span><br></pre></td></tr></table></figure><blockquote><p>书中还讲到了环境变量LD_LIBRARY_PATH,该环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径。但是两个服务器这个值都还不存在。</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> var=value</span><br><span class="line"><span class="meta">></span> var = value</span><br><span class="line">-bash: var: command not found</span><br><span class="line"><span class="meta">></span> var="hello world"</span><br><span class="line"><span class="meta">></span> echo var</span><br><span class="line">var</span><br><span class="line"><span class="meta">></span> echo $var</span><br><span class="line">hello world</span><br><span class="line"><span class="meta">></span> echo ${var}</span><br><span class="line">hello world</span><br><span class="line"><span class="meta">></span> echo $vars</span><br><span class="line"></span><br><span class="line"><span class="meta">></span> echo ${var}s</span><br><span class="line">hello worlds</span><br><span class="line"><span class="meta">></span> echo '$var'</span><br><span class="line"><span class="meta">$</span>var</span><br><span class="line"><span class="meta">></span> echo "$var"</span><br><span class="line">hello world</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> var=value</span><br><span class="line"><span class="meta">></span> length=${#var}</span><br><span class="line"><span class="meta">></span> echo $length</span><br><span class="line">5</span><br></pre></td></tr></table></figure><blockquote><p>一些内置值</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo $SHELL</span><br><span class="line">/bin/bash</span><br><span class="line"><span class="meta">></span> echo $0</span><br><span class="line">-bash</span><br><span class="line"><span class="meta">></span> echo $PATH</span><br><span class="line">/root/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin</span><br><span class="line"><span class="meta">></span> echo $HOME</span><br><span class="line">/root</span><br><span class="line"><span class="meta">></span> echo $PWD</span><br><span class="line">/root</span><br><span class="line"><span class="meta">></span> echo $USER</span><br><span class="line">root</span><br><span class="line"><span class="meta">></span> echo $UID</span><br><span class="line">0</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">vip7@VM-0-15-ubuntu:~$ echo $USER</span><br><span class="line">vip7</span><br><span class="line">vip7@VM-0-15-ubuntu:~$ echo $UID</span><br><span class="line">1011</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line">export PATH="/root/anaconda3/bin:$PATH" #只在本次shell对话中有效</span><br><span class="line"><span class="meta">></span> echo $PATH</span><br><span class="line">/root/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin</span><br><span class="line">``` </span><br><span class="line"><span class="meta">#</span># 数学运算</span><br><span class="line">```shell</span><br><span class="line"><span class="meta">></span> a=1</span><br><span class="line"><span class="meta">></span> b=2</span><br><span class="line"><span class="meta">></span> let c=a+b</span><br><span class="line"><span class="meta">></span> echo $c</span><br><span class="line">3</span><br><span class="line"><span class="meta">></span> let a++</span><br><span class="line"><span class="meta">></span> echo $a</span><br><span class="line">2</span><br><span class="line"><span class="meta">></span> c=$[a+b]</span><br><span class="line"><span class="meta">></span> echo $c</span><br><span class="line">4</span><br><span class="line"><span class="meta">></span> let b+=4</span><br><span class="line"><span class="meta">></span> echo $b</span><br><span class="line">6</span><br><span class="line"><span class="meta">></span> c=$((a+b))</span><br><span class="line"><span class="meta">></span> echo $c</span><br><span class="line">8</span><br><span class="line"><span class="meta">></span> d=`expr a+b`</span><br><span class="line"><span class="meta">></span> echo $d</span><br><span class="line">a+b</span><br><span class="line"><span class="meta">></span> d=`expr $a+$b`</span><br><span class="line"><span class="meta">></span> echo $d</span><br><span class="line">2+6</span><br><span class="line"><span class="meta">></span> d=`expr $a + $b`</span><br><span class="line"><span class="meta">></span> echo $d</span><br><span class="line">8</span><br><span class="line"><span class="meta">></span> d=`expr $a \* $b` #只有这里的*需要转义</span><br><span class="line"><span class="meta">></span> echo $d</span><br><span class="line">12</span><br><span class="line"><span class="meta">></span> echo "4*0.35" | bc</span><br><span class="line">1.40</span><br><span class="line"><span class="meta">></span> result=`echo "$a*1.24" | bc`</span><br><span class="line"><span class="meta">></span> echo $result</span><br><span class="line">2.48</span><br><span class="line"><span class="meta">></span> number=100</span><br><span class="line"><span class="meta">></span> echo "obase=2;$number" | bc</span><br><span class="line">1100100</span><br><span class="line"><span class="meta">></span> number=1100100</span><br><span class="line"><span class="meta">></span> echo "obase=10;ibase=2;$number" | bc</span><br><span class="line">100</span><br><span class="line"><span class="meta">></span> echo "sqrt(100);10^10" | bc</span><br><span class="line">10</span><br><span class="line">10000000000</span><br></pre></td></tr></table></figure><h2 id="文件描述符"><a href="#文件描述符" class="headerlink" title="文件描述符"></a>文件描述符</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">重定向</span><br><span class="line">0 --- stdin</span><br><span class="line">1 --- stdout</span><br><span class="line">2 --- stderr</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo "some" > some.txt</span><br><span class="line"><span class="meta">></span> cat some.txt</span><br><span class="line">some</span><br><span class="line"><span class="meta">></span> echo "word" >> some.txt</span><br><span class="line"><span class="meta">></span> cat some.txt</span><br><span class="line">some</span><br><span class="line">word</span><br><span class="line"><span class="meta">></span> ls +</span><br><span class="line">ls: cannot access +: No such file or directory</span><br><span class="line"><span class="meta">></span> echo $? #命令执行状态</span><br><span class="line">2 #非0代表失败</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">anaconda3 hello.sh some.txt</span><br><span class="line"><span class="meta">></span> echo $?</span><br><span class="line">0 #代表成功</span><br><span class="line"><span class="meta">></span> ls + 2> err.txt #错误重定向</span><br><span class="line"><span class="meta">></span> cat err.txt</span><br><span class="line">ls: cannot access +: No such file or directory </span><br><span class="line"><span class="meta">></span> cmd > some.txt 2>&1 #标准错误重定向到标准输出</span><br><span class="line"><span class="meta">></span> cat some.txt</span><br><span class="line">-bash: cmd: command not found</span><br><span class="line"><span class="meta">></span> ls + &> out.txt #标准错误和标准输出均重定向</span><br><span class="line"><span class="meta">></span> ls + 2> /dev/null #错误重定向到黑洞</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> ls | tee out.txt | cat -n # tee将stdin写入文件的同时提供一份副本到管道</span><br><span class="line"> 1anaconda3</span><br><span class="line"> 2err.txt</span><br><span class="line"> 3hello.sh</span><br><span class="line"> 4out.txt</span><br><span class="line"> 5some.txt</span><br><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line">anaconda3</span><br><span class="line">err.txt</span><br><span class="line">hello.sh</span><br><span class="line">out.txt</span><br><span class="line">some.txt</span><br><span class="line"><span class="meta">></span> echo hello | tee -a out.txt</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line">anaconda3</span><br><span class="line">err.txt</span><br><span class="line">hello.sh</span><br><span class="line">out.txt</span><br><span class="line">some.txt</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> echo who | tee - # -代表stdin 提供一份副本到标准输出</span><br><span class="line">who</span><br><span class="line">who</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo some > out.txt </span><br><span class="line"><span class="meta">></span> cat < out.txt #文件内容重定向到命令</span><br><span class="line">some</span><br><span class="line"></span><br><span class="line"><span class="meta">></span> cat<<EOF>out.txt #EOF之间的内容重定向cat 然后重定向到out.txt EOF是一个tag可以替换成其他词</span><br><span class="line"><span class="meta">></span> hello</span><br><span class="line"><span class="meta">></span> boy</span><br><span class="line"><span class="meta">></span> EOF</span><br><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line">hello</span><br><span class="line">boy</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">< --- 从文件读取到stdin</span><br><span class="line">> --- 截断模式写入文件</span><br><span class="line">>>--- 追加模式写入文件</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo this is a line > input.txt</span><br><span class="line"><span class="meta">></span> exec 3< input.txt #不能使用0,1,2 创建自己的文件描述符</span><br><span class="line"><span class="meta">></span> cat <&3 </span><br><span class="line">this is a line #再次读取需要重新分配文件描述符</span><br></pre></td></tr></table></figure><h2 id="数组"><a href="#数组" class="headerlink" title="数组"></a>数组</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> array=(1 2 3 4 5) #普通数组</span><br><span class="line"><span class="meta">></span> array[5]=6</span><br><span class="line"><span class="meta">></span> echo ${array[5]}</span><br><span class="line">6</span><br><span class="line"><span class="meta">></span> index=2</span><br><span class="line"><span class="meta">></span> echo ${array[$index]}</span><br><span class="line">3</span><br><span class="line"><span class="meta">></span> echo ${array[*]}</span><br><span class="line">1 2 3 4 5 6</span><br><span class="line"><span class="meta">></span> array[10]=1</span><br><span class="line"><span class="meta">></span> echo ${#array[*]}</span><br><span class="line">7</span><br><span class="line"><span class="meta">></span> echo ${array[*]}</span><br><span class="line">1 2 3 4 5 6 1</span><br><span class="line"><span class="meta">></span> echo ${array[10]}</span><br><span class="line">1</span><br><span class="line"><span class="meta">></span> echo ${array[9]}</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> declare -A ass_array #定义关联数组</span><br><span class="line"><span class="meta">></span> ass_array=([index1]=val1 [index2]=val2})</span><br><span class="line"><span class="meta">></span> ass_array[index3]=val3</span><br><span class="line"><span class="meta">></span> echo ${ass_array[index3]}</span><br><span class="line">val3</span><br><span class="line"><span class="meta">></span> echo ${ass_array[*]}</span><br><span class="line">val1 val2} val3</span><br><span class="line"><span class="meta">></span> echo ${!ass_array[*]}</span><br><span class="line">index1 index2 index3</span><br></pre></td></tr></table></figure><h2 id="别名"><a href="#别名" class="headerlink" title="别名"></a>别名</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> alias ls='ls -ll'</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">total 4</span><br><span class="line">drwxr-xr-x 22 root root 4096 Oct 5 2018 anaconda3</span><br><span class="line"><span class="meta">></span> \ls</span><br><span class="line">anaconda3</span><br></pre></td></tr></table></figure><h2 id="获取终端信息"><a href="#获取终端信息" class="headerlink" title="获取终端信息"></a>获取终端信息</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">stty -echo #禁止将输出发送到终端</span><br><span class="line">stty echo #允许将输出发送到终端</span><br><span class="line">tput sc #存储光标位置</span><br><span class="line">tput rc #恢复光标位置</span><br><span class="line">tput ed #清除从当前光标到行末尾的所有内容</span><br></pre></td></tr></table></figure><h2 id="时间和日期"><a href="#时间和日期" class="headerlink" title="时间和日期"></a>时间和日期</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> date</span><br><span class="line">Sun Nov 18 18:22:25 CST 2018</span><br><span class="line"><span class="meta">></span> date +%s</span><br><span class="line">1542536551</span><br><span class="line"><span class="meta">></span> date --date "Nov 18 2018" +%A</span><br><span class="line">Sunday</span><br><span class="line"><span class="meta">></span> date "+%d %B %Y"</span><br><span class="line">18 November 2018</span><br><span class="line"><span class="meta">></span> date -s "2018 11 18 18:23:22"</span><br><span class="line">date: invalid date ‘2018 11 18 18:23:22’</span><br><span class="line"><span class="meta">></span> date -s "2018 Nov 18 18:23:22"</span><br><span class="line">date: invalid date ‘2018 Nov 18 18:23:22’</span><br><span class="line"><span class="meta">></span> date -s "18 Nov 2018 18:23:22"</span><br><span class="line">Sun Nov 18 18:23:22 CST 2018</span><br><span class="line"><span class="meta">></span> sleep 10</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">星期 %a %A</span><br><span class="line">月 %b %B</span><br><span class="line">日 %d</span><br><span class="line">固定格式日期 %D</span><br><span class="line">年 %y %Y</span><br><span class="line">小时 %I %H</span><br><span class="line">分钟 %M</span><br><span class="line">秒 %S</span><br><span class="line">纳秒 %N</span><br><span class="line">Unix纪元时 %s</span><br></pre></td></tr></table></figure><h2 id="调试脚本"><a href="#调试脚本" class="headerlink" title="调试脚本"></a>调试脚本</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo echo some > out.sh</span><br><span class="line"><span class="meta">></span> bash -x out.sh</span><br><span class="line">+ echo some</span><br><span class="line">some</span><br><span class="line"><span class="meta">></span> for i in {1..3}; do set -x; echo $i; set +x; done</span><br><span class="line">+ echo 1</span><br><span class="line">1</span><br><span class="line">+ set +x</span><br><span class="line">+ echo 2</span><br><span class="line">2</span><br><span class="line">+ set +x</span><br><span class="line">+ echo 3</span><br><span class="line">3</span><br><span class="line">+ set +x</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">set -x 在执行时显示参数和命令</span><br><span class="line">set +x 禁止调试</span><br><span class="line">set -v 当命令进行读取时显示输入</span><br><span class="line">set +v 禁止打印输入</span><br></pre></td></tr></table></figure><p>调试便捷方法<br>将<code>#!/bin/bash</code>改为<code>#!/bin/bash -xv</code></p><h2 id="函数"><a href="#函数" class="headerlink" title="函数"></a>函数</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">function fname()</span><br><span class="line">{</span><br><span class="line"> statements;</span><br><span class="line">}</span><br><span class="line">fname()</span><br><span class="line">{</span><br><span class="line"> statements;</span><br><span class="line">}</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> fname()</span><br><span class="line"><span class="meta">></span> {</span><br><span class="line"><span class="meta">></span> echo $1,$2;</span><br><span class="line"><span class="meta">></span> echo "$@"; </span><br><span class="line"><span class="meta">></span> echo "$*"; </span><br><span class="line"><span class="meta">></span> return 0;</span><br><span class="line"><span class="meta">></span> }</span><br><span class="line"><span class="meta">></span> fname my world</span><br><span class="line">my,world</span><br><span class="line">my world</span><br><span class="line">my world</span><br></pre></td></tr></table></figure><p><code>$*</code> 和 <code>$@</code> 都表示传递给函数或脚本的所有参数,不被双引号<code>" "</code>包含时,都以<code>"$1" "$2" … "$n"</code> 的形式输出所有参数。<br>但是当它们被双引号<code>" "</code>包含时,<code>"$*"</code> 会将所有的参数作为一个整体,以<code>"$1 $2 … $n"</code>的形式输出所有参数;<code>"$@"</code> 会将各个参数分开,以<code>"$1" "$2" … "$n"</code> 的形式输出所有参数。</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">$0当前脚本的文件名</span><br><span class="line">$n传递给脚本或函数的参数。n 是一个数字,表示第几个参数。例如,第一个参数是$1,第二个参数是$2。</span><br><span class="line">$#传递给脚本或函数的参数个数。</span><br><span class="line">$*传递给脚本或函数的所有参数。</span><br><span class="line">$@传递给脚本或函数的所有参数。</span><br><span class="line">$?上个命令的退出状态,或函数的返回值。一般情况下,大部分命令执行成功会返回 0,失败返回 非0。</span><br><span class="line">$$当前Shell进程ID。对于 Shell 脚本,就是这些脚本所在的进程ID。</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat parent.sh</span><br><span class="line"><span class="meta">#</span>!/bin/bash</span><br><span class="line">plus1(){ echo $(($1+1));}</span><br><span class="line">echo $(plus1 4)</span><br><span class="line">export -f plus1 #使函数子进程可用</span><br><span class="line">./child.sh 3 4</span><br><span class="line"><span class="meta">></span> vim child.sh</span><br><span class="line"><span class="meta">></span> cat child.sh</span><br><span class="line"><span class="meta">#</span>!/bin/bash</span><br><span class="line">echo $(plus1 $(($1 * $2)))</span><br><span class="line"><span class="meta">></span> chmod a+x *.sh</span><br><span class="line"><span class="meta">></span> ./parent.sh</span><br><span class="line">5</span><br><span class="line">13</span><br><span class="line"><span class="meta">></span> cmd="echo some"</span><br><span class="line"><span class="meta">></span> $cmd #好神奇啊我也不知道为啥</span><br><span class="line">some</span><br></pre></td></tr></table></figure><h2 id="将输出写入变量"><a href="#将输出写入变量" class="headerlink" title="将输出写入变量"></a>将输出写入变量</h2><blockquote><p>管道操作符 <code>cmd1 | cmd2 | cmd3</code></p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> ls | cat -n >out.txt</span><br><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line"> 1anaconda3</span><br><span class="line"> 2out.txt</span><br><span class="line"><span class="meta">></span> output=$(ls | cat -n)</span><br><span class="line"><span class="meta">></span> echo $output</span><br><span class="line">1 anaconda3 2 out.txt</span><br><span class="line"><span class="meta">></span> output=`ls | cat -n`</span><br><span class="line"><span class="meta">></span> echo $output</span><br><span class="line">1 anaconda3 2 out.txt</span><br></pre></td></tr></table></figure><blockquote><p>子shell</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> pwd</span><br><span class="line">/root</span><br><span class="line"><span class="meta">></span> (cd /data;ls)</span><br><span class="line">Anaconda3-5.1.0-Linux-x86_64.sh index.txt</span><br><span class="line"><span class="meta">></span> pwd</span><br><span class="line">/root</span><br><span class="line"><span class="meta">></span> cat text.txt</span><br><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line"><span class="meta">></span> out=$(cat text.txt)</span><br><span class="line"><span class="meta">></span> echo $out</span><br><span class="line">1 2 3</span><br><span class="line"><span class="meta">></span> out="$(cat text.txt)"</span><br><span class="line"><span class="meta">></span> echo $out</span><br><span class="line">1 2 3</span><br></pre></td></tr></table></figure><h2 id="read"><a href="#read" class="headerlink" title="read"></a>read</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> read -n 2 var</span><br><span class="line"><span class="meta">12></span> echo $var</span><br><span class="line">12</span><br><span class="line"><span class="meta">></span> read -s password #输入时无回显</span><br><span class="line"><span class="meta">></span> echo $password</span><br><span class="line">simonyang</span><br><span class="line"><span class="meta">></span> read -p "Please enter your Name:" var</span><br><span class="line">Please enter your Name:simonyang</span><br><span class="line"><span class="meta">></span> echo $var</span><br><span class="line">simonyang</span><br><span class="line"><span class="meta">></span> read -d . var</span><br><span class="line">simon.> echo $var</span><br><span class="line">simon</span><br></pre></td></tr></table></figure><blockquote><p><code>read -t 2 var</code>要求两秒内输入</p></blockquote><h2 id="运行命令直至成功"><a href="#运行命令直至成功" class="headerlink" title="运行命令直至成功"></a>运行命令直至成功</h2><blockquote><p><code>true</code>作为<code>/bin</code>中的一个二进制文件实现<br>shell内建的<code>:</code>总是返回0的退出码</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> repeat() {while :; do $@ && return ; done}</span><br></pre></td></tr></table></figure><h2 id="字段分隔符-IFS"><a href="#字段分隔符-IFS" class="headerlink" title="字段分隔符 IFS"></a>字段分隔符 IFS</h2><blockquote><p>IFS的默认值为空白字符(换行符、制表符或者空格)</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> for item in "1 2 3";do echo $item;done</span><br><span class="line">1 2 3</span><br><span class="line"><span class="meta">></span> oldifs=$IFS</span><br><span class="line"><span class="meta">></span> IFS=,</span><br><span class="line"><span class="meta">></span> for item in "1,2,3";do echo $item;done</span><br><span class="line">1 2 3</span><br><span class="line"><span class="meta">></span> IFS=$oldifs</span><br><span class="line"><span class="meta">></span> for item in "1,2,3";do echo $item;done</span><br><span class="line">1,2,3</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">for var in list;</span><br><span class="line">do </span><br><span class="line"> commands;</span><br><span class="line">done</span><br><span class="line">for((i=0;i<10;i++))</span><br><span class="line">{</span><br><span class="line"> commands;</span><br><span class="line">}</span><br><span class="line">while condition;</span><br><span class="line">do </span><br><span class="line"> commands;</span><br><span class="line">done</span><br><span class="line">until condition; #直到条件为真</span><br><span class="line">do</span><br><span class="line"> commands;</span><br><span class="line">done</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> for i in {a..g};do echo $i;done</span><br><span class="line">a</span><br><span class="line">b</span><br><span class="line">c</span><br><span class="line">d</span><br><span class="line">e</span><br><span class="line">f</span><br><span class="line">g</span><br></pre></td></tr></table></figure><h2 id="比较"><a href="#比较" class="headerlink" title="比较"></a>比较</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">if condition;</span><br><span class="line">then</span><br><span class="line"> commands;</span><br><span class="line">fi</span><br><span class="line">if condition;</span><br><span class="line">then</span><br><span class="line"> commands;</span><br><span class="line">else if condition;</span><br><span class="line">then</span><br><span class="line"> commands;</span><br><span class="line">else</span><br><span class="line"> commands;</span><br><span class="line">fi</span><br></pre></td></tr></table></figure><blockquote><p><code>[ condition ] && action</code> #如果真,则action运行<br><code>[ condition ] || action</code> #如果假,则action运行</p></blockquote><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">算术比较</span><br><span class="line">-eq equal返回真 </span><br><span class="line">-ne not equal返回真</span><br><span class="line">-gt greater than返回真</span><br><span class="line">-lt less than返回真</span><br><span class="line">-ge greater or equal返回真</span><br><span class="line">-le less or equal返回真</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> if [ 5 -eq 5 -a 4 -gt 3]; then echo true;fi</span><br><span class="line">-bash: [: missing `]' #3与]应有空格,5与[也是</span><br><span class="line"><span class="meta">></span> if [ 5 -eq 5 -a 4 -gt 3 ]; then echo true;fi</span><br><span class="line">true</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">文件系统测试,是为真</span><br><span class="line">[ -f $var ] 是否包含文件路径和文件名 </span><br><span class="line">[ -x $var ] 是否可执行</span><br><span class="line">[ -d $var ] 是否是目录</span><br><span class="line">[ -e $var ] 是否存在</span><br><span class="line">[ -c $var ] 是否是字符设备</span><br><span class="line">[ -b $var ] 是否是块设备</span><br><span class="line">[ -w $var ] 是否可写</span><br><span class="line">[ -r $var ] 是否可读</span><br><span class="line">[ -L $var ] 是否是符号链接</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> if [ -f out.txt ]; then echo true;fi</span><br><span class="line">true</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">anaconda3 out.txt text.txt</span><br><span class="line"><span class="meta">></span> if [ ! -L out.txt ]; then echo true;fi # !取反</span><br><span class="line">true</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">字符串比较,是为真</span><br><span class="line">最好使用双中括号,str1和str2前后都有空格</span><br><span class="line">[[ $str1 = $str2 ]] 是否相等</span><br><span class="line">[[ $str1 == $str2 ]] 是否相等</span><br><span class="line">[[ $str1 != $str2 ]] 是否不相等</span><br><span class="line">[[ $str1 > $str2 ]] 按字母序,str1是否大于str2</span><br><span class="line">[[ $str1 > $str2 ]] 按字母序,str1是否小于str1</span><br><span class="line">[[ -z $str2 ]] 是否是空字符串</span><br><span class="line">[[ -n $str2 ]] 是否是非空字符串</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> str1="hello"</span><br><span class="line"><span class="meta">></span> str2=''</span><br><span class="line"><span class="meta">></span> if [[ -n $str1 ]] && [[ -z $str2 ]];then echo true;fi</span><br><span class="line">true</span><br></pre></td></tr></table></figure><blockquote><p>使用test</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> if test $var -eq 1;then echo true;fi</span><br><span class="line">true</span><br><span class="line"><span class="meta">></span> if ! test $var -eq 0;then echo true;fi</span><br><span class="line">true</span><br></pre></td></tr></table></figure><h1 id="命令之乐"><a href="#命令之乐" class="headerlink" title="命令之乐"></a>命令之乐</h1><h2 id="cat"><a href="#cat" class="headerlink" title="cat"></a>cat</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo this is a line > out.txt </span><br><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line">this is a line</span><br><span class="line"><span class="meta">></span> echo this is a new line >out2.txt</span><br><span class="line"><span class="meta">></span> cat out.txt out2.txt</span><br><span class="line">this is a line</span><br><span class="line">this is a new line</span><br><span class="line"><span class="meta">></span> echo some new | cat - out.txt</span><br><span class="line">some new</span><br><span class="line">this is a line</span><br></pre></td></tr></table></figure><hr><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line">1</span><br><span class="line">2</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">3</span><br><span class="line"><span class="meta">></span> cat -s out.txt</span><br><span class="line">1</span><br><span class="line">2</span><br><span class="line"></span><br><span class="line">3</span><br><span class="line"><span class="meta">></span> cat some.py</span><br><span class="line">def hello():</span><br><span class="line">print("hello world")</span><br><span class="line"><span class="meta">></span> cat -T some.py</span><br><span class="line">def hello():</span><br><span class="line">^Iprint("hello world")</span><br><span class="line"><span class="meta">></span> cat -n some.py</span><br><span class="line"> 1def hello():</span><br><span class="line"> 2print("hello world")</span><br><span class="line"><span class="meta">></span> cat -n out.txt</span><br><span class="line"> 11</span><br><span class="line"> 22</span><br><span class="line"> 3</span><br><span class="line"> 4</span><br><span class="line"> 5</span><br><span class="line"> 6</span><br><span class="line"> 73</span><br><span class="line"><span class="meta">></span> cat -nb out.txt</span><br><span class="line"> 11</span><br><span class="line"> 22</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> 33</span><br></pre></td></tr></table></figure><h2 id="script"><a href="#script" class="headerlink" title="script"></a>script</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> script -t 2> timelog.log -a output.session</span><br><span class="line">Script started, file is output.session</span><br><span class="line"><span class="meta">></span> echo hello > new.txt</span><br><span class="line"><span class="meta">></span> cat new.txt</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> exit</span><br><span class="line">exit</span><br><span class="line">Script done, file is output.session</span><br><span class="line"><span class="meta">></span> cat output.session</span><br><span class="line">Script started on Sat 24 Nov 2018 04:24:45 PM CST</span><br><span class="line"><span class="meta">></span> echo hello > new.txt</span><br><span class="line"><span class="meta">></span> cat new.txt</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> exit</span><br><span class="line">exit</span><br><span class="line"></span><br><span class="line">Script done on Sat 24 Nov 2018 04:25:07 PM CST</span><br><span class="line"></span><br><span class="line"><span class="meta">></span> scriptreplay timelog.log output.session #重放</span><br></pre></td></tr></table></figure><h2 id="find"><a href="#find" class="headerlink" title="find"></a>find</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cd /home</span><br><span class="line"><span class="meta">></span> touch some.py out1.txt out2.txt</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">out1.txt out2.txt some.py</span><br><span class="line"><span class="meta">></span> find . </span><br><span class="line">.</span><br><span class="line">./out2.txt</span><br><span class="line">./out1.txt</span><br><span class="line">./some.py</span><br><span class="line"><span class="meta">></span> find . -print0</span><br><span class="line">../out2.txt./out1.txt./some.py> find . -name "*.txt"</span><br><span class="line">./out2.txt</span><br><span class="line">./out1.txt</span><br><span class="line"><span class="meta">></span> find . -name *.txt</span><br><span class="line">find: paths must precede expression: out2.txt</span><br><span class="line">Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]</span><br><span class="line"><span class="meta">></span> touch OUT.txt</span><br><span class="line"><span class="meta">></span> find . -iname "out*"</span><br><span class="line">./out2.txt</span><br><span class="line">./OUT.txt</span><br><span class="line">./out1.txt</span><br><span class="line"><span class="meta">></span> touch some.log</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">out1.txt out2.txt OUT.txt some.log some.py</span><br><span class="line"><span class="meta">></span> find . \( -name "*.txt" -o -name "*.log" \) </span><br><span class="line">./out2.txt</span><br><span class="line">./OUT.txt</span><br><span class="line">./out1.txt</span><br><span class="line">./some.log</span><br><span class="line"><span class="meta">></span> find /root/ -path "*/.ssh/*"</span><br><span class="line">/root/.ssh/authorized_keys</span><br><span class="line"><span class="meta">></span> find . -regex ".*\(\.py\|\.txt\)$"</span><br><span class="line">./out2.txt</span><br><span class="line">./OUT.txt</span><br><span class="line">./out1.txt</span><br><span class="line">./some.py</span><br><span class="line"><span class="meta">></span> touch some.PY</span><br><span class="line"><span class="meta">></span> find . -iregex ".*\.py$"</span><br><span class="line">./some.PY</span><br><span class="line">./some.py</span><br><span class="line"><span class="meta">></span> find . ! -iregex ".*\.py$"</span><br><span class="line">.</span><br><span class="line">./out2.txt</span><br><span class="line">./OUT.txt</span><br><span class="line">./out1.txt</span><br><span class="line">./some.log</span><br><span class="line"><span class="meta">></span> mkdir some</span><br><span class="line"><span class="meta">></span> mv out* some/</span><br><span class="line"><span class="meta">></span> find . -maxdepth 1 </span><br><span class="line">.</span><br><span class="line">./some.PY</span><br><span class="line">./OUT.txt</span><br><span class="line">./some</span><br><span class="line">./some.py</span><br><span class="line">./some.log</span><br><span class="line"><span class="meta">></span> find .</span><br><span class="line">.</span><br><span class="line">./some.PY</span><br><span class="line">./OUT.txt</span><br><span class="line">./some</span><br><span class="line">./some/out2.txt</span><br><span class="line">./some/out1.txt</span><br><span class="line">./some.py</span><br><span class="line">./some.log</span><br><span class="line"><span class="meta">></span> find . -mindepth 2</span><br><span class="line">./some/out2.txt</span><br><span class="line">./some/out1.txt</span><br><span class="line"><span class="meta">></span> find . -type d # d指目录,同样的还有f l </span><br><span class="line">.</span><br><span class="line">./some</span><br></pre></td></tr></table></figure><blockquote><p>访问时间 -atime 用户最近一次访问文件的时间 access<br>修改时间 -mtime 文件内容最后一次被修改的时间 modify<br>变化时间 -ctime 文件元数据最后一次改变的时间 change<br>作为时间选项 单位是天 -表示小于 +表示大于<br>以分钟为计量单位 -amin -mmin -cmin</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> vim OUT.txt</span><br><span class="line"><span class="meta">></span> find . -cmin -1</span><br><span class="line">.</span><br><span class="line">./OUT.txt</span><br><span class="line"><span class="meta">></span> find . -newer some.PY</span><br><span class="line">.</span><br><span class="line">./OUT.txt</span><br><span class="line">./some</span><br><span class="line"><span class="meta">></span> find . -size -1 #</span><br><span class="line">./some.PY</span><br><span class="line">./some/out2.txt</span><br><span class="line">./some/out1.txt</span><br><span class="line">./some.py</span><br><span class="line">./some.log</span><br><span class="line"><span class="meta">></span> find . -size +1c #大于1字节 </span><br><span class="line">.</span><br><span class="line">./OUT.txt</span><br><span class="line">./some</span><br></pre></td></tr></table></figure><blockquote><p>b 块 512字节<br> c 字节<br> w 字 2字节<br> k 1024字节<br> M 1024K字节<br> G 1024M字节</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> ls</span><br><span class="line">OUT.txt some some.log some.py some.PY</span><br><span class="line"><span class="meta">></span> find . -size +1c -delete</span><br><span class="line">find: cannot delete ‘./some’: Directory not empty</span><br><span class="line"><span class="meta">></span> ls -l</span><br><span class="line">total 4</span><br><span class="line">drwxr-xr-x 2 root root 4096 Nov 24 16:52 some</span><br><span class="line">-rw-r--r-- 1 root root 0 Nov 24 16:41 some.log</span><br><span class="line">-rw-r--r-- 1 root root 0 Nov 24 16:37 some.py</span><br><span class="line">-rw-r--r-- 1 root root 0 Nov 24 16:48 some.PY</span><br><span class="line"><span class="meta">></span> find . -maxdepth 1 -perm 755 </span><br><span class="line">.</span><br><span class="line">./some</span><br><span class="line"><span class="meta">></span> find . -maxdepth 1 -user root</span><br><span class="line">.</span><br><span class="line">./some.PY</span><br><span class="line">./some</span><br><span class="line">./some.py</span><br><span class="line">./some.log</span><br><span class="line"><span class="meta">></span> find . -maxdepth 1 -name "some.*" -exec chmod 755 {} \; # {} 每次代入文件名然后每次运行</span><br><span class="line"><span class="meta">></span> ls -l</span><br><span class="line">total 4</span><br><span class="line">drwxr-xr-x 2 755 root 4096 Nov 24 16:52 some</span><br><span class="line">-rwxr-xr-x 1 755 root 0 Nov 24 16:41 some.log</span><br><span class="line">-rwxr-xr-x 1 755 root 0 Nov 24 16:37 some.py</span><br><span class="line">-rwxr-xr-x 1 755 root 0 Nov 24 16:48 some.PY</span><br><span class="line"><span class="meta">></span> find . -maxdepth 1 -name "some.*" -exec chmod 644 {} +; # {} 传入所有文件名然后一次运行</span><br><span class="line"><span class="meta">></span> ls -l</span><br><span class="line">total 4</span><br><span class="line">drwxr-xr-x 2 755 root 4096 Nov 24 16:52 some</span><br><span class="line">-rw-r--r-- 1 755 root 0 Nov 24 16:41 some.log</span><br><span class="line">-rw-r--r-- 1 755 root 0 Nov 24 16:37 some.py</span><br><span class="line">-rw-r--r-- 1 755 root 0 Nov 24 16:48 some.PY</span><br><span class="line"><span class="meta">></span> cat some.py</span><br><span class="line">def hi():</span><br><span class="line">pass</span><br><span class="line"><span class="meta">></span> cat some.PY</span><br><span class="line">def hello():</span><br><span class="line">pass</span><br><span class="line"><span class="meta">></span> find . -iname "*.py" -exec cat {} \;> final</span><br><span class="line"><span class="meta">></span> cat final</span><br><span class="line">def hello():</span><br><span class="line">pass</span><br><span class="line">def hi():</span><br><span class="line">pass</span><br><span class="line"><span class="meta">></span> find ~/ -name ".git" -prune #跳过.git目录</span><br></pre></td></tr></table></figure><h2 id="xargs"><a href="#xargs" class="headerlink" title="xargs"></a>xargs</h2><blockquote><p>xargs 命令将标准输入数据转换成命令行参数</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat out.txt</span><br><span class="line">1 2 3 4 5</span><br><span class="line">6 7 8</span><br><span class="line">9</span><br><span class="line"><span class="meta">></span> cat out.txt | xargs</span><br><span class="line">1 2 3 4 5 6 7 8 9</span><br><span class="line"><span class="meta">></span> cat out.txt | xargs -n 3</span><br><span class="line">1 2 3</span><br><span class="line">4 5 6</span><br><span class="line">7 8 9</span><br><span class="line"><span class="meta">></span> echo "splitXsplitXsplit" | xargs -d X # d delimiter</span><br><span class="line">split split split</span><br></pre></td></tr></table></figure><hr><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat demo.sh</span><br><span class="line">echo $* #</span><br><span class="line"><span class="meta">></span> cat args.txt</span><br><span class="line">arg1</span><br><span class="line">arg2</span><br><span class="line">arg3</span><br><span class="line"><span class="meta">></span> cat args.txt | xargs -n 2 ./demo.sh</span><br><span class="line">arg1 arg2</span><br><span class="line">arg3</span><br><span class="line"><span class="meta">></span> cat args.txt | xargs -I {} ./demo.sh -p {} # -I指定替换名称 对于每个参数执行一次</span><br><span class="line">-p arg1</span><br><span class="line">-p arg2</span><br><span class="line">-p arg3</span><br><span class="line"><span class="meta">></span> cat args.txt | xargs -I p ./demo.sh -p -l</span><br><span class="line">-arg1 -l</span><br><span class="line">-arg2 -l</span><br><span class="line">-arg3 -l</span><br></pre></td></tr></table></figure><blockquote><p>将find与xargs结合使用时定界符应该是<code>\0</code></p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> ls</span><br><span class="line">args.txt demo.sh out.txt</span><br><span class="line"><span class="meta">></span> find . -name "out.*" -print0 | xargs -0 rm -f #-print0 将`\0`作为定界符输出文件名 xargs -0 将`\0`作为定界符分开</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">demo.sh</span><br><span class="line"><span class="meta">></span> cat files.txt</span><br><span class="line">args1.txt</span><br><span class="line">args2.txt</span><br><span class="line"><span class="meta">></span> cat args1.txt</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> cat args2.txt</span><br><span class="line">hi</span><br><span class="line"><span class="meta">></span> cat files.txt | xargs -I {} cat {}</span><br><span class="line">hello</span><br><span class="line">hi</span><br><span class="line"><span class="meta">></span> cat files.txt | (while read arg; do cat $arg; done ) #利用子shell实现相似功能</span><br><span class="line">hello</span><br><span class="line">hi</span><br></pre></td></tr></table></figure><h2 id="tr"><a href="#tr" class="headerlink" title="tr"></a>tr</h2><blockquote><p>tr只能通过stdin接受输入 </p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo "HELLO" | tr "A-Z" 'a-z' #'z-a'是行不通的</span><br><span class="line">hello</span><br><span class="line"><span class="meta">></span> echo "HELLO" | tr "A-Z" 'b'</span><br><span class="line">bbbbb</span><br><span class="line"><span class="meta">></span> echo "HELLO I AM" | tr -d 'A-H'</span><br><span class="line">LLO I M</span><br><span class="line"><span class="meta">></span> echo "HELLO I AM" | tr -d -c 'A-H\n' #-c选择补集</span><br><span class="line">HEA</span><br><span class="line"><span class="meta">></span> echo hello i am your friend | tr -s ' ' # 压缩</span><br><span class="line">hello i am your friend</span><br><span class="line"><span class="meta">></span> echo hello i am your friend | tr [:lower:] [:upper:] </span><br><span class="line">HELLO I AM YOUR FRIEND</span><br></pre></td></tr></table></figure><h2 id="md5sum-sha1sum"><a href="#md5sum-sha1sum" class="headerlink" title="md5sum sha1sum"></a>md5sum sha1sum</h2><blockquote><p>计算校验和<br>md5sum 和 sha1sum 使用非常相似</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> md5sum demo.sh</span><br><span class="line">e88d83ea97b4461177c708b8760045a8 demo.sh</span><br><span class="line"><span class="meta">></span> md5sum demo.sh > demo.md5</span><br><span class="line"><span class="meta">></span> md5sum -c demo.md5</span><br><span class="line">demo.sh: OK</span><br></pre></td></tr></table></figure><h2 id="gpg-base64"><a href="#gpg-base64" class="headerlink" title="gpg base64"></a>gpg base64</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat demo.sh</span><br><span class="line">echo $* #</span><br><span class="line"><span class="meta">></span> gpg -c demo.sh</span><br><span class="line"><span class="meta">></span> gpg demo.sh.gpg</span><br><span class="line"><span class="meta">></span> base64 demo.sh > out</span><br><span class="line"><span class="meta">></span> cat out</span><br><span class="line">ZWNobyAkKiAjCg==</span><br><span class="line"><span class="meta">></span> base64 -d out | cat -</span><br><span class="line">echo $* #</span><br></pre></td></tr></table></figure><h2 id="sort-uniq"><a href="#sort-uniq" class="headerlink" title="sort uniq"></a>sort uniq</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat files.txt</span><br><span class="line">3</span><br><span class="line">3</span><br><span class="line">9</span><br><span class="line">3</span><br><span class="line">2</span><br><span class="line">8</span><br><span class="line"><span class="meta">></span> sort files.txt</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">3</span><br><span class="line">3</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line"><span class="meta">></span> sort -r files.txt</span><br><span class="line">9</span><br><span class="line">8</span><br><span class="line">3</span><br><span class="line">3</span><br><span class="line">3</span><br><span class="line">2</span><br><span class="line"><span class="meta">></span> sort -r files.txt | uniq</span><br><span class="line">9</span><br><span class="line">8</span><br><span class="line">3</span><br><span class="line">2</span><br></pre></td></tr></table></figure><blockquote><p>uniq的输入要求必须排序过,如果已经排序sort会返回0的退出码,否则返回非0</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat data.txt</span><br><span class="line">9 mac 8000</span><br><span class="line">7 dell 7000</span><br><span class="line">10 lenovo 6000</span><br><span class="line"><span class="meta">></span> sort -nk 1 data.txt #按数字大小</span><br><span class="line">7 dell 7000</span><br><span class="line">9 mac 8000</span><br><span class="line">10 lenovo 6000</span><br><span class="line"><span class="meta">></span> sort -k 1 data.txt #字母序</span><br><span class="line">10 lenovo 6000</span><br><span class="line">7 dell 7000</span><br><span class="line">9 mac 8000</span><br><span class="line"><span class="meta">></span> sort -rk 3 data.txt</span><br><span class="line">9 mac 8000</span><br><span class="line">7 dell 7000</span><br><span class="line">10 lenovo 6000</span><br><span class="line"><span class="meta">></span> sort -k 2.2 data.txt #按照第二列第二个字符排列,因为默认的分隔是把 "非空白到空白转换" 做为分段的依据,所以按照d,l,m排列</span><br><span class="line">7 dell 7000</span><br><span class="line">10 lenovo 6000</span><br><span class="line">9 mac 8000</span><br><span class="line"><span class="meta">></span> sort -t ' ' -k 2.2 data.txt #-t 制定空格作为分隔符,第二列第二个字符所以按照a,e,e排列</span><br><span class="line">9 mac 8000</span><br><span class="line">7 dell 7000</span><br><span class="line">10 lenovo 6000</span><br></pre></td></tr></table></figure><blockquote><p>-o 输出到指定文件,可以覆盖原文件<br>–f 忽略大小写<br>-c 检查文件是否已排好序,如果乱序,则输出第一个乱序的行的相关信息,最后返回1<br>-C 检查文件是否已排好序,如果乱序,不输出内容,仅返回1<br>-M 以月份来排序,比如JAN小于FEB等等<br>-b 忽略每一行前面的所有空白部分<br>-z 用<code>\0</code>结束行<br>-m 合并<br>-u 删除重复行</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat files.txt</span><br><span class="line">3</span><br><span class="line">3</span><br><span class="line">9</span><br><span class="line">3</span><br><span class="line">2</span><br><span class="line">8</span><br><span class="line"><span class="meta">></span> sort files.txt -o files.txt</span><br><span class="line"><span class="meta">></span> uniq -u files.txt #只显示唯一行</span><br><span class="line">2</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line"><span class="meta">></span> uniq -c files.txt #统计次数</span><br><span class="line"> 1 2</span><br><span class="line"> 3 3</span><br><span class="line"> 1 8</span><br><span class="line"> 1 9</span><br><span class="line"><span class="meta">></span> uniq -d files.txt #显示重复行</span><br><span class="line">3</span><br><span class="line"><span class="meta">></span> cat data.txt</span><br><span class="line">9mac8000</span><br><span class="line">7dell7000</span><br><span class="line">1lenovo6000</span><br><span class="line"><span class="meta">></span> cat data.txt | uniq -s 2 -w 1 # 忽略前两个字符比较一个字符</span><br><span class="line">9mac8000</span><br><span class="line">7dell7000</span><br></pre></td></tr></table></figure><h2 id="mktemp"><a href="#mktemp" class="headerlink" title="mktemp"></a>mktemp</h2><blockquote><p>/tmp目录中的内容系统重启后清空</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> filename=`mktemp` #反引号运行</span><br><span class="line"><span class="meta">></span> echo $filename</span><br><span class="line">/tmp/tmp.iBLhJgtGp3</span><br><span class="line"><span class="meta">></span> filename=`mktemp -d`</span><br><span class="line"><span class="meta">></span> echo $filename</span><br><span class="line">/tmp/tmp.0ojbVHR0ZG</span><br><span class="line"><span class="meta">></span> filename=`mktemp -u` #不创建实际文件</span><br><span class="line"><span class="meta">></span> mktemp test.XXX #根据模板创建</span><br><span class="line">test.7Ou</span><br></pre></td></tr></table></figure><h2 id="split"><a href="#split" class="headerlink" title="split"></a>split</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> dd if=/dev/urandom of=test.file bs=13MB count=1 #创建13m大小的文件</span><br><span class="line">1+0 records in</span><br><span class="line">1+0 records out</span><br><span class="line">13000000 bytes (13 MB) copied, 0.0903847 s, 144 MB/s</span><br><span class="line"><span class="meta">></span> split -b 1m test.file #以1M大小划分</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">test.file xaa xab xac xad xae xaf xag xah xai xaj xak xal xam</span><br><span class="line"><span class="meta">></span> rm -f x* #删除x开头所有文件</span><br><span class="line"><span class="meta">></span> split -b 5m test.file -d -a 3 split #数字结尾 结尾三个数字 split开头</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">split000 split001 split002 test.file</span><br><span class="line"><span class="meta">></span> split -l 10 test.file #10行分</span><br><span class="line"><span class="meta">></span> cat server.log</span><br><span class="line">SERVER-1</span><br><span class="line">[connection]</span><br><span class="line">[disconnect]</span><br><span class="line">[connection]</span><br><span class="line">[disconnect]</span><br><span class="line">SERVER-2</span><br><span class="line">[connection]</span><br><span class="line">[disconnect]</span><br><span class="line">SERVER-3</span><br><span class="line">[disconnect]</span><br><span class="line">[connection]</span><br><span class="line"><span class="meta">></span> csplit server.log /SERVER/ -n 1 {*} -f split -b "%d.log" #/SERVER/正则匹配 -n 1 文件后数字后缀一个 -f 前缀是split -b 后缀格式 {*} 分割执行次数</span><br><span class="line">0</span><br><span class="line">61</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">server.log split0.log split1.log split2.log split3.log</span><br><span class="line"><span class="meta">></span> cat split0.log #split0.log是分隔前的,所以没有内容</span><br><span class="line"><span class="meta">></span> cat split1.log</span><br><span class="line">SERVER-1</span><br><span class="line">[connection]</span><br><span class="line">[disconnect]</span><br><span class="line">[connection]</span><br><span class="line">[disconnect]</span><br></pre></td></tr></table></figure><h2 id><a href="#" class="headerlink" title="{ }"></a>{ }</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> filename=some.tar.gz #必须使用变量</span><br><span class="line"><span class="meta">></span> name=${filename%.*} #从尾向前匹配.*短数据删除</span><br><span class="line"><span class="meta">></span> echo $name</span><br><span class="line">new.tar</span><br><span class="line"><span class="meta">></span> name=${filename%%.*} #从尾向前匹配.*长数据删除</span><br><span class="line"><span class="meta">></span> echo $name</span><br><span class="line">some</span><br><span class="line"><span class="meta">></span> name=${filename#*.} #从前向尾匹配*.短数据删除</span><br><span class="line"><span class="meta">></span> echo $name</span><br><span class="line">tar.gz</span><br><span class="line"><span class="meta">></span> name=${filename##*.} #从前向尾匹配*.长数据删除</span><br><span class="line"><span class="meta">></span> echo $name</span><br><span class="line">gz</span><br><span class="line"><span class="meta">></span> filename=new.new.some</span><br><span class="line"><span class="meta">></span> name=${filename/new/hi} #new替换成hi,值替换一次</span><br><span class="line"><span class="meta">></span> echo $name</span><br><span class="line">hi.new.some</span><br><span class="line"><span class="meta">></span> name=${filename//new/hi} </span><br><span class="line"><span class="meta">></span> echo $name</span><br><span class="line">hi.hi.some</span><br></pre></td></tr></table></figure><p>抄一张图,懒得挨个试了<br><img src="http://cdn.simonyang.club/20181125-20150620201642326.jpg" alt="20181125-20150620201642326"></p><h2 id="rename-mv-cp"><a href="#rename-mv-cp" class="headerlink" title="rename mv cp"></a>rename mv cp</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span>!/bin/bash</span><br><span class="line">count=1;</span><br><span class="line">for img in `find . -maxdepth 1 -iname "*.jpg" -o -iname "*.png" -type f`;</span><br><span class="line">do</span><br><span class="line"> new=image-$count.${img##*.} #重命名</span><br><span class="line"> mv "$img" "$new" # 移动</span><br><span class="line"> let count++</span><br><span class="line">done</span><br></pre></td></tr></table></figure><hr><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> rename JPG jpg *.JPG</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">new.jpg old.jpg</span><br></pre></td></tr></table></figure><blockquote><p>在我的服务器上rename正则使用失败,网上查不到原因</p></blockquote><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> mkdir pic</span><br><span class="line"><span class="meta">></span> mv new.jpg ./pic</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">old.jpg pic</span><br><span class="line"><span class="meta">></span> (cd pic;ls)</span><br><span class="line">new.jpg</span><br><span class="line"><span class="meta">></span> cp old.jpg ./pic</span><br><span class="line"><span class="meta">></span> (cd pic;ls)</span><br><span class="line">new.jpg old.jpg</span><br><span class="line"><span class="meta">></span> ls</span><br><span class="line">old.jpg pic</span><br></pre></td></tr></table></figure><h2 id="look-read"><a href="#look-read" class="headerlink" title="look read"></a>look read</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> cat word.txt</span><br><span class="line">abc</span><br><span class="line">bcd</span><br><span class="line">cde</span><br><span class="line"><span class="meta">></span> look bc word.txt #寻找bc开头的行</span><br><span class="line">bcd</span><br><span class="line"><span class="meta">></span> grep "^a" word.txt #寻找a开头的行</span><br><span class="line">abc</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span>!/bin/bash</span><br><span class="line">read -p "Enter your name:" name</span><br><span class="line">echo "you name is $name"</span><br></pre></td></tr></table></figure><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">></span> echo -e "hello\n" | ./hello.sh</span><br><span class="line">you name is hello</span><br><span class="line"><span class="meta">></span> echo -e "simon\n" > input</span><br><span class="line"><span class="meta">></span> ./hello.sh <input</span><br><span class="line">you name is simon</span><br></pre></td></tr></table></figure><h2 id="amp-后台执行"><a href="#amp-后台执行" class="headerlink" title="&后台执行"></a>&后台执行</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span>!/bin/bash</span><br><span class="line">pidarray=()</span><br><span class="line">for file in File1.iso File2.iso;</span><br><span class="line">do</span><br><span class="line"> md5sum $file & #后台运行</span><br><span class="line"> pidarray+=("$!") #获取进程pid</span><br><span class="line">done</span><br><span class="line">wait ${pidarray[@]}</span><br></pre></td></tr></table></figure><h1 id="以文件之名"><a href="#以文件之名" class="headerlink" title="以文件之名"></a>以文件之名</h1>]]></content>
<categories>
<category> shell </category>
</categories>
</entry>
<entry>
<title>软件安装管家</title>
<link href="/2018/11/16/2018/software_manager/"/>
<url>/2018/11/16/2018/software_manager/</url>
<content type="html"><![CDATA[<p>唉,一共才50多粉丝,我还要安利别人的公众号,真是免费帮别人打广告<br>不过抄过来一篇文章实在不好,广告打就打吧</p><p>明天大一新生就要开始建模大业了,总有人问我matlab怎么装。<br>下面一个公众号解决你所有大学常用软件的安装问题</p><h1 id="软件安装管家"><a href="#软件安装管家" class="headerlink" title="软件安装管家"></a>软件安装管家</h1><p><img src="http://cdn.simonyang.club/20181111-mmexport1541937141613.gif" alt="20181111-mmexport1541937141613"><br>下面是他提供的软件安装教程目录,如果你还是懒得看教程装,就是想花钱要服务,公众号 回复 软件+联系方式 我学会了帮你装,感谢<br><img src="http://cdn.simonyang.club/20181111-S81111-19500198.jpg" alt="20181111-S81111-19500198"><br><img src="http://cdn.simonyang.club/20181111-S81111-19502596.jpg" alt="20181111-S81111-19502596"></p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>双十一,手机淘宝,启动</title>
<link href="/2018/11/10/2018/singledogday/"/>
<url>/2018/11/10/2018/singledogday/</url>
<content type="html"><![CDATA[<p>又到了一年一度的双十一,大家又都开始剁手了<br>我就想问一句,你的花呗还完了吗?<br>哈哈哈</p><h2 id><a href="#" class="headerlink" title></a><img src="http://cdn.simonyang.club/20181110-20.jpg" alt="20181110-20"></h2><p>我杨某人在这送给大家四句话<br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110205027.jpg" alt="20181110-QQ截图20181110205027"><br>不过再怎么说该买的还是要买的,毕竟双十一确实便宜。<br>像我这种日常穷的人,从到学校开始就没网购过,压抑着我的购物天性,等着双十一狠狠剁他一次手。<br>不过今天的主题当然不是分享我如何剁手,我来分享几个我觉得真正看得见的实惠活动,就是那种直接打折、减免没有淘宝那么多规则的。然后再理性分析一波,京东、淘宝、天猫哪个最真诚。</p><h1 id="图灵社区"><a href="#图灵社区" class="headerlink" title="图灵社区"></a><a href="http://www.ituring.com.cn/" target="_blank" rel="noopener">图灵社区</a></h1><p>图灵社区是我两年多来买书最多的地方,优惠也是实打实的<br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110205649.jpg" alt="20181110-QQ截图20181110205649"><br>我一般都是买电子书,所以明天我肯定是要买上他两三本的。<br>实体书的话可能看起来没啥意思,不过实体书我一般都是到京东买<a href="https://sale.jd.com/act/d3jQcOWlPDB.html" target="_blank" rel="noopener">京东自营书籍</a>,买不到盗版<br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110205916.jpg" alt="20181110-QQ截图20181110205916"><br>另外图灵社区每周都有<a href="http://www.ituring.com.cn/tag/36527" target="_blank" rel="noopener">电子书半价</a>属于雷打不动的活动,如果喜欢的电子书哪一周半价,剁手是肯定的。</p><blockquote><p>原谅我一个准程序员只知道日常屯书</p></blockquote><h1 id="域名"><a href="#域名" class="headerlink" title="域名"></a>域名</h1><p>域名这个确实不是刚需是吧,不过今天我偶然看到腾讯云.club后缀的域名新用户只要一元一年,一元一年唉,啧啧啧,我又不是缺那一块钱,买一个</p><blockquote><p>技术宅可以趁机买个女朋友名字的域名,哪天给个惊喜<br>我是技术宅可是我没有女朋友,单身狗哭了<br><a href="https://cloud.tencent.com/act/domainsales?from=10029" target="_blank" rel="noopener">活动在这</a><br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110211041.jpg" alt="20181110-QQ截图20181110211041"></p></blockquote><h1 id="Udacity"><a href="#Udacity" class="headerlink" title="Udacity"></a>Udacity</h1><p>优达学城就是我昨天推荐的那个学习网站,这个网站,别人都说好,不过我一个穷人从来没买过他的课,不过毕竟口碑非常好,也推荐给大家,而且udacity几乎没有过活动打折,双十一他们终于有了<br><a href="https://cn.udacity.com/20181111" target="_blank" rel="noopener">Udacity</a><br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110211340.jpg" alt="20181110-QQ截图20181110211340"><br>优惠非常的实际粗暴,我喜欢</p><hr><h1 id="Last"><a href="#Last" class="headerlink" title="Last"></a>Last</h1><p>最后我来分析一波京东、天猫、淘宝到底哪个双十一最实诚<br>也就是双十一之前的涨价最少<br>比较的东西是 <a href="https://item.jd.com/11867803.html" target="_blank" rel="noopener">周志华的《机器学习》</a><br>(这也是本好书虽然我没看过)</p><p>首先我们来看看京东<br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110211633.jpg" alt="20181110-QQ截图20181110211633"><br>他告诉我历史最低价是61.6 最高价是84.5 现在的价格是83.6 最高价附近,上涨了22元,不过右边也告诉我们,如果用上了两个活动,最低可以38.5入手,是历史最低的。</p><p>让我们看看天猫</p><blockquote><p>天猫淘宝没有自营我就直接选综合排名第一的吧</p></blockquote><p>天猫这家店叫 清文图书专卖店<br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110212320.jpg" alt="20181110-QQ截图20181110212320"><br>很干净的下滑,最高66,最低44,目前最低,很棒</p><p>最后来看看淘宝<br>淘宝这家店叫新华文轩网络书店,看名字应该是老牌书店了<br><img src="http://cdn.simonyang.club/20181110-QQ%E6%88%AA%E5%9B%BE20181110212604.jpg" alt="20181110-QQ截图20181110212604"><br>最高价73.9,最低价58,看起来明天双十一特惠价钱才是44,笑死</p><blockquote><p>天猫和淘宝好歹一家公司出来的差别怎么这么大呢</p></blockquote><p>上面用的插件是 购物党全网自动比价工具【预览版】淘宝京东美亚日亚比价、180天价格历史跟踪、降价提醒<br>(名字怎么这么长,chrome插件)</p><p>祝大家剁手愉快<br><img src="http://cdn.simonyang.club/20181110-61.jpg" alt="20181110-61"></p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>uzerme</title>
<link href="/2018/11/08/2018/uzerme/"/>
<url>/2018/11/08/2018/uzerme/</url>
<content type="html"><![CDATA[<p>今天废话不多说,就推荐一个网站<br>网址如下<br><a href="https://uzer.me/" target="_blank" rel="noopener">Uzer.me</a><br>手快的人已经把网址复制粘贴打开浏览器看看我说的什么玩意了<br>那麻烦你下边不用看了如果切中了你的痛点你肯定会记住这个网址的 </p><hr><p>手慢的人还在犹豫要不要信我<br>还在想我葫芦里到底卖的什么药<br>我就姑且再废话几句安利一下<br>如果你有以下几点需求 </p><ul><li>Photoshop、Matlab、Xmind偶尔使用但是不想装到电脑上</li><li>正版党但是买不起Photoshop、Matlab正版</li><li>手边没有电脑但是急需处理Office文档</li><li>还有暂时我没想到。。</li></ul><p>Bingo!<br>这个网站适合你<br>如你所想,这个网站就是远程使用Office系列套件、Matlab、Xmind、Photoshop等软件的地方<br>如下<br><img src="http://cdn.simonyang.club/2018118-QQ%E6%88%AA%E5%9B%BE20181108175936.jpg" alt="2018118-QQ截图20181108175936"><br>不过Uzer.me打开火狐浏览器冲浪感觉怪怪的emm<br>当然,你知道这个网站之后,你还需要一个好的网速<br>今天就到这里,觉得不错请转发,有建议请留言!<br><img src="http://cdn.simonyang.club/2018118-54.jpg" alt="2018118-54"></p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>onetab解放你的chrome多标签</title>
<link href="/2018/11/06/2018/onetab/"/>
<url>/2018/11/06/2018/onetab/</url>
<content type="html"><![CDATA[<p>今天介绍一个Chrome插件</p><h1 id="onetab"><a href="#onetab" class="headerlink" title="onetab"></a>onetab</h1><p>其实具体来说呢, onetab的出现是为了解决像这样的问题<br><img src="http://cdn.simonyang.club/20181031-QQ%E6%88%AA%E5%9B%BE20181031173343.jpg" alt="20181031-QQ截图20181031173343"><br>哇,这么多标签!<br>我每个标签都有用!<br>我每个标签都不能关!<br>啊啊啊!<br>炸裂! </p><hr><p>当然如果你习惯性关标签请直接pass!</p><p>在我的日常使用中是经常出现这种状况的,因为我经常为了解决一个技术问题打开很多页面,每个页面都有那么一点我需要的东西,所以不能关,但是开着也很烦人,还占内存,众所周知,Chrome是个占内存大户,怎么办捏! </p><hr><p>经过我的一番寻找,找到了onetab这个牛逼玩意<br><a href="https://www.one-tab.com/" target="_blank" rel="noopener">官网在这</a><br>看一下官网<br><img src="http://cdn.simonyang.club/20181031-QQ%E6%88%AA%E5%9B%BE20181031172618.jpg" alt="20181031-QQ截图20181031172618"><br>可以省95%内存,很棒<br>再看一下具体介绍<br><img src="http://cdn.simonyang.club/20181031-QQ%E6%88%AA%E5%9B%BE20181031172635.jpg" alt="20181031-QQ截图20181031172635"><br>说是把所有页面汇集成一个list<br>那我们用一下呗<br>点击安装,装好之后<br><img src="http://cdn.simonyang.club/20181031-QQ%E6%88%AA%E5%9B%BE20181031173343.jpg" alt="20181031-QQ截图20181031173343">点击这里面的右上角的onetab标签<br>duang的一下<br>就变成这样了<br><img src="http://cdn.simonyang.club/20181031-QQ%E6%88%AA%E5%9B%BE20181031173820.jpg" alt="20181031-QQ截图20181031173820"><br>所有的标签都汇集到了一起,需要的点开重新加载就好了<br>当然<br>每一次点onetab的标签列表是单独的<br>像这样<br><img src="http://cdn.simonyang.club/20181031-QQ%E6%88%AA%E5%9B%BE20181031173956.jpg" alt="20181031-QQ截图20181031173956"><br>其实我还会把onetab当收藏夹用,把好的网址都放到一个标签列表里,这样chrome的书签栏就不会炸掉了</p><p>什么?<br>你不是chrome用户,那有firefox吗,firefox浏览器也有这个插件<br>什么?<br>你用360、搜狗?<br>换chrome吧<br>chrome大法好,哈哈哈哈 </p><p>什么?<br>你不能科学上网装不了插件<br>插件从这下<br><a href="https://www.chromefor.com/" target="_blank" rel="noopener">https://www.chromefor.com/</a><br>然后百度一波chrome怎么装本地插件<br>Bingo!</p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>学会快捷键的骚操作</title>
<link href="/2018/11/06/2018/shortcut/"/>
<url>/2018/11/06/2018/shortcut/</url>
<content type="html"><![CDATA[<blockquote><p>本文默认win10系统</p></blockquote><h2 id="触摸板"><a href="#触摸板" class="headerlink" title="触摸板"></a>触摸板</h2><p>你可能不知道的触摸板使用方法<br><img src="http://cdn.simonyang.club/2018115-QQ%E6%88%AA%E5%9B%BE20181105160926.jpg" alt="2018115-QQ截图20181105160926"><br>当然这些还可以自己设置(在你的设置里,自己挖掘一下)<br><img src="http://cdn.simonyang.club/2018115-QQ%E6%88%AA%E5%9B%BE20181105163201.jpg" alt="2018115-QQ截图20181105163201"></p><h2 id="鼠标"><a href="#鼠标" class="headerlink" title="鼠标"></a>鼠标</h2><p>下面讲一下鼠标<br>鼠标其实除了左键右键其实还有中键<br>什么,中键?<br>对,就是那个滚轮,他还可以向下按,向下按啊<br>(如果你的鼠标够高级,它还可以向左拨,向右拨) </p><h3 id="向下按"><a href="#向下按" class="headerlink" title="向下按"></a>向下按</h3><ol><li>浏览器链接在新标签中打开</li><li>关闭标签(在浏览器标签上点击)</li><li>点击任务栏预览页关闭程序(当你把鼠标放在任务栏上程序图标上时,会出现一个预览的小窗口,中键点击这个小窗口关闭这个程序)</li><li>打开一个新的程序窗口(当一个程序已经打开,这时你想要再打开一个相同程序的时候)</li><li>查看 QQ 聊天信息的准确时间<h3 id="向左拨"><a href="#向左拨" class="headerlink" title="向左拨"></a>向左拨</h3></li><li>浏览器返回前一个页面</li><li>文件资源管理器返回上一个位置<h3 id="向右拨"><a href="#向右拨" class="headerlink" title="向右拨"></a>向右拨</h3></li><li>撤销刚刚向左拨的操作</li></ol><blockquote><p>感谢旺隆<br><a href="https://zhuanlan.zhihu.com/p/32564388" target="_blank" rel="noopener">https://zhuanlan.zhihu.com/p/32564388</a></p></blockquote><h2 id="键盘"><a href="#键盘" class="headerlink" title="键盘"></a>键盘</h2><p>小白注意:</p><ol><li>笔记本上的Fn键是为了配合F1-F12键上右下角的小图标使用的。使用Fn+Esc组合键可以切换Fn+F1..F12和F1..F12的功能,如果你按了F5并没有刷新页面,那么按Fn+Esc切换后再按F5或者按一下Fn+F5就可以了;</li><li>Tab缩进与n个空格不一样;</li><li>左边Alt旁边的那个窗口键叫Win键。</li></ol><hr><p>好了下面正式开始</p><h3 id="单键"><a href="#单键" class="headerlink" title="单键"></a>单键</h3><pre><code>Esc:退出F1:帮助F2:选中文件时重命名F3:搜索F4:文件资源管理器中光标移至地址栏F5:刷新、重新整理F6:浏览器光标移至地址栏F8:开机时进入安全模式F11: 全屏显示F12:浏览器中打开开发者页面PrtScr:PrintScreen的缩写,按一下可以截屏,然后Ctrl+V粘贴,不过我更喜欢用qq的截屏功能Insert:切换输入时的插入与替换操作Delete:移动文件到回收站、删除光标右侧的一个字符Tab:页面移动CapsLock:大写锁定Shift:按住时点击鼠标连续多选Ctrl:按住时点击鼠标间隔多选</code></pre><h3 id="组合键"><a href="#组合键" class="headerlink" title="组合键"></a>组合键</h3><p><em>只罗列一些比较常用的,如果需要全部整理的话,请留言</em></p><pre><code>Ctrl+1,2,3:切换到从左边数起第1,2,3个标签Ctrl+C:复制Ctrl+X:剪切Ctrl+V:粘贴Ctrl+A:全选Ctrl+Z:撤销Ctrl+S:保存Ctrl+O:打开Ctrl+P: 打印Ctrl+F:搜索Ctrl+W:关闭当前页面Ctrl+Shift+W:关闭所有页面Ctrl+T:打开新的页面Ctrl+Shift+T:打开刚刚关闭的页面Ctrl+F5:强制刷新Ctrl+Tab:切换页面Ctrl+Shift+Tab:反向切换页面Ctrl+N:生成新程序页面Ctrl+Shift+N:新建文件夹Ctrl+Alt+A:QQ截图Alt+F4:关闭当前程序Alt+Tab:切换程序Alt+Shift+Tab:反向切换程序Win+Tab:激活任务视图Win+A:激活操作中心Win+D:显示桌面Win+E:打开文件资源管理器Win+I:打开设置Win+L:锁定屏幕Win+P:投影屏幕Win+R:运行Win+X:打开高级用户功能Win+1/2/3:打开任务栏中固定的程序win+空格:输入法切换Shift+Delete:永久删除文件Ctrl+Shift+Esc:打开任务资源管理器Ctrl+Alt+Delete:终结计算机的异常状态拖动某一项时按CTRL复制所选项目</code></pre><blockquote><p>感谢每天学点电脑知识<br>电脑快捷键使用大全,秒变电脑大神! - 每天学点电脑知识的文章 - 知乎<br><a href="https://zhuanlan.zhihu.com/p/38998190" target="_blank" rel="noopener">https://zhuanlan.zhihu.com/p/38998190</a></p></blockquote><h2 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h2><p>小常识:<br>中文输入时的标点符号和英文输入时的标点符号不一样,不一样!看一下<br>中文:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">·-=【】、;‘,。/</span><br><span class="line">~!@#¥%……&*()——+{}|:“《》?</span><br></pre></td></tr></table></figure><p>英文:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">`-=[]\;',./</span><br><span class="line">~!@#$%^&*()_+{}|:"<>?</span><br></pre></td></tr></table></figure><p>除了少数几个其他基本上都不一样,写代码的时候一定要小心噢!</p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>火萤酱介绍</title>
<link href="/2018/11/05/2018/huoyingjiang/"/>
<url>/2018/11/05/2018/huoyingjiang/</url>
<content type="html"><![CDATA[<p>今天来推荐一个神器,电脑必备,查文件神器<br>主要是我经常用而且还觉得不错,他就是</p><h1 id="火萤酱"><a href="#火萤酱" class="headerlink" title="火萤酱"></a>火萤酱</h1><p>让我们来看看他的官网<br><a href="https://j.huoying666.com/" target="_blank" rel="noopener">官网</a><br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE20181030184420.jpg" alt="20181030-QQ截图20181030184420"><br>嗯,看起来很牛逼的样子,我们下载下来用一下<br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE2018.jpg" alt="20181030-QQ截图2018"><br>双击ctrl是打开魔法大门的钥匙啊!<br>安装好之后试一试<br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE20181030184707.jpg" alt="20181030-QQ截图20181030184707"><br>搜的还挺快,除了本地搜东西,还可以shift切换到网络搜索<br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE20181030184837.jpg" alt="20181030-QQ截图20181030184837"><br>这些搜索其实还可以定制<br>除了本地搜索、网络搜索,其实还有一些常用贴心功能<br>像这些<br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE20181030185027.jpg" alt="20181030-QQ截图20181030185027"><br>是不是不错,尝试一下吧,我真的没拿广告费<br>(火萤酱本地搜索功能由内置的everything提供,everything大家都应该知道,不过火萤酱使用更便捷,yes) </p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>how to learn pyhon</title>
<link href="/2018/10/15/2018/learn-pyhon/"/>
<url>/2018/10/15/2018/learn-pyhon/</url>
<content type="html"><![CDATA[<blockquote><p>这是送给想学编程的同学的一篇推文 </p></blockquote><p>说起来学习Python也算有三年了,从高中二年级的一本《Python基础教程》开始,我就踏上了Python学习(掉发)的道路。<br>(竟然过了这么久了)<br><img src="http://cdn.simonyang.club/2018119-mmexport1529730405773.jpg" alt="2018119-mmexport1529730405773"><br>Python目前也算是最火的语言(之一)了吧!<br>这是TIOBE 2018年11月的排行榜<br><img src="http://cdn.simonyang.club/2018119-QQ%E6%88%AA%E5%9B%BE20181109193717.jpg" alt="2018119-QQ截图20181109193717"><br>TIOBE排名衡量编程语言的流行程度<br>可以说只要你能想象的到需要编程的地方都可以用Python,Python也因为太火走进了培训班emm</p><blockquote><p><strong>小嘀咕</strong><br>要是我早出生几年还是一样走现在的道路学习python说不定就年薪多少多少了。<br>唉,说多了都是泪啊,所以说人赶不上时代。</p></blockquote><p><strong>继续正经脸</strong>:<br>我当初选择python入门也是因为刷了刷知乎,大家说他简单、容易入门。<br>但是其实几年学习下来,python入门简单,但是学好写好还是挺难的。</p><blockquote><p><strong>小建议</strong>:<br>学习编程语言千万不要在入门用什么语言上纠结太久,如果你觉得python适合,那么买一本书开始看,如果你觉得java适合,也买一本书开始看。<br>开始看书写代码是第一步,纠结学什么语言是纯粹浪费时间。<br>当然,根据我的经验来看,学习好python,深刻理解面向对象的内涵还是很容易转到java、c#上的。<br>通过python的深入学习也可以了解很多计算机领域的概念,这个时候转到其他语言就轻而易举了。</p></blockquote><hr><blockquote><p><strong>注意</strong></p><ul><li>看一本书写了一点代码并不能保证你入门</li><li>两三本书+各种教程博客+学会百度是必须的</li><li>多写代码会调bug才是王道</li></ul></blockquote><h1 id="下面开始学习"><a href="#下面开始学习" class="headerlink" title="下面开始学习"></a>下面开始学习</h1><h2 id="下载-amp-安装:"><a href="#下载-amp-安装:" class="headerlink" title="下载&安装:"></a>下载&安装:</h2><p>进入Python3.7.1下载界面<br><a href="https://www.python.org/downloads/release/python-371/" target="_blank" rel="noopener"><strong>Python 3.7.1 releases</strong></a><br>操作系统是32位的选择x86, 64位的选择x86-64<br>windows选择executable installer<br>其他平台按需选择<br>点击下载、双击安装</p><blockquote><p>安装的时候需要勾选add to path,这样可以省去配置环境变量的苦恼<br>注意装好之后去开始菜单找Python,桌面上没有</p></blockquote><hr><blockquote><p>当你开始厌烦pip安装包出现的各种问题时,考虑使用Anaconda吧,各种依赖一次性安装免去各种配置烦恼<br><a href="https://www.anaconda.com/download/" target="_blank" rel="noopener">Anaconda</a><br>但是官网有些慢,建议选择<br><a href="https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/" target="_blank" rel="noopener">Anaconda清华镜像</a><br>Anaconda内置Spyder和jupyter notebook, 真的推荐。 </p></blockquote><h2 id="入门"><a href="#入门" class="headerlink" title="入门"></a>入门</h2><h3 id="书籍:"><a href="#书籍:" class="headerlink" title="书籍:"></a>书籍:</h3><p>如果你想买一本实体书看<br>(碰巧后天双十一大促) </p><ul><li><p>目前最火的是这一本<br><a href="http://www.ituring.com.cn/book/1861" target="_blank" rel="noopener">《Python编程:从入门到实践》</a><br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE20181030164425.jpg" alt="20181030-QQ截图20181030164425"></p></li><li><p>我看的是这一本<br><a href="http://www.ituring.com.cn/book/2118" target="_blank" rel="noopener">《Python基础教程(第3版)》</a><br><img src="http://cdn.simonyang.club/20181030-QQ%E6%88%AA%E5%9B%BE20181030164446.jpg" alt="20181030-QQ截图20181030164446"><br>个人感觉后一本比前一本难一些</p></li><li><p>如果你想看pdf或者网页版<br><a href="https://www.gitbook.com/book/lenkimo/byte-of-python-chinese-edition/details" target="_blank" rel="noopener">简明python教程</a></p></li></ul><h3 id="网络教程"><a href="#网络教程" class="headerlink" title="网络教程"></a>网络教程</h3><ul><li><p><a href="http://www.runoob.com/python3/python3-tutorial.html" target="_blank" rel="noopener">Runoob Python3 教程</a> </p></li><li><p><a href="https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000" target="_blank" rel="noopener">廖雪峰Python新手教程</a><br>说实话,廖雪峰教程对新手来说有点难。 </p></li><li><p>如果你英文足够好,那就直接刚官方教程<br><a href="https://docs.python.org/3/tutorial/index.html" target="_blank" rel="noopener">Python官方tutorial</a></p></li></ul><h3 id="互动学习"><a href="#互动学习" class="headerlink" title="互动学习"></a>互动学习</h3><p>想边学习边写代码<br>这有个好网站, 但是需要你英语不错<br><a href="https://www.codecademy.com/catalog/language/python" target="_blank" rel="noopener">Codecademy</a></p><h3 id="视频"><a href="#视频" class="headerlink" title="视频"></a>视频</h3><p>我很少看视频,我觉得看视频不如看书效率高。<br>想要像上课那样的学习环境的话可以去<a href="https://www.coursera.org/" target="_blank" rel="noopener">coursera</a>或者<a href="https://cn.udacity.com" target="_blank" rel="noopener">udacity</a>找一找。</p><h3 id="社区"><a href="#社区" class="headerlink" title="社区"></a>社区</h3><ul><li>多刷刷知乎还是不错的<br><a href="https://www.zhihu.com/topic/19552832/top-answers" target="_blank" rel="noopener">知乎python话题</a></li></ul><h3 id="帮助"><a href="#帮助" class="headerlink" title="帮助"></a>帮助</h3><p>学习的很迷,不知道内部操作到底是什么样的<br>试一下这个代码逻辑可视化网站<br><a href="http://www.pythontutor.com/" target="_blank" rel="noopener">Python tutor</a> </p><blockquote><p>最推荐的路径是上面两本书都看完然后去学习爬虫写一些项目;<br>根据经验来看花钱买课程的话更容易好好学习,因为谁都不想自己花的钱被浪费。</p></blockquote>]]></content>
<categories>
<category> python </category>
</categories>
</entry>
<entry>
<title>Multisim</title>
<link href="/2018/09/09/2018/Multisim/"/>
<url>/2018/09/09/2018/Multisim/</url>
<content type="html"><![CDATA[<p><em>感谢信息青协支持,信息青协电脑交流群284933381</em></p><p>Multisim 13.0.1汉化破解版 链接:<a href="https://pan.baidu.com/s/1eXxn55auHOB-7rGuCb8KoQ" target="_blank" rel="noopener">https://pan.baidu.com/s/1eXxn55auHOB-7rGuCb8KoQ</a> 密码:t7xq</p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>VC++</title>
<link href="/2018/09/09/2018/VC++/"/>
<url>/2018/09/09/2018/VC++/</url>
<content type="html"><![CDATA[<p><em>感谢信息青协支持,信息青协电脑交流群284933381</em></p><p>Visual_C++_6.0-win10 链接:<a href="https://pan.baidu.com/s/1WfY4Oz8u8nxKjMI-mJmpIw" target="_blank" rel="noopener">https://pan.baidu.com/s/1WfY4Oz8u8nxKjMI-mJmpIw</a> 密码:sje0</p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>Office</title>
<link href="/2018/09/09/2018/Office/"/>
<url>/2018/09/09/2018/Office/</url>
<content type="html"><![CDATA[<p><em>资源来源为<a href="https://msdn.itellyou.cn/" target="_blank" rel="noopener">MSDN,我告诉你</a></em><br>office2016 专业版 链接:<a href="https://pan.baidu.com/s/1GhT6q6caArSgp44cqwfWYg" target="_blank" rel="noopener">https://pan.baidu.com/s/1GhT6q6caArSgp44cqwfWYg</a> 密码:j3fl</p><p><em>资源来源为<a href="http://www.yishimei123.com/" target="_blank" rel="noopener">亦是美</a></em><br>破解程序 链接:<a href="https://pan.baidu.com/s/1MPuqqas4qhxcdQWaG3Ff5Q" target="_blank" rel="noopener">https://pan.baidu.com/s/1MPuqqas4qhxcdQWaG3Ff5Q</a> 密码:we3v<br>建议装完office之后重启一次再进行激活,激活前关闭windows defender,激活时需要联网,需要的话激活后再开启defender即可</p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>Matlab</title>
<link href="/2018/09/09/2018/Matlab/"/>
<url>/2018/09/09/2018/Matlab/</url>
<content type="html"><![CDATA[<p><em>感谢信息青协支持,信息青协电脑交流群284933381</em></p><p>matlab软件资源<br>matlab2018 链接:<a href="https://pan.baidu.com/s/1WNkzz4XKHElqTdi35QyZ-Q" target="_blank" rel="noopener">https://pan.baidu.com/s/1WNkzz4XKHElqTdi35QyZ-Q</a> 密码:zstx<br>matlab2016 链接:<a href="https://pan.baidu.com/s/1cx72VimXuhW8RChy70HcSw" target="_blank" rel="noopener">https://pan.baidu.com/s/1cx72VimXuhW8RChy70HcSw</a> 密码:vvyj<br>两个文件均内含破解教程</p><p>matlab</p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>Saladict 插件 安利</title>
<link href="/2018/09/02/2018/saladict/"/>
<url>/2018/09/02/2018/saladict/</url>
<content type="html"><![CDATA[<p>日常安利之<br>英文阅读插件</p><p>对于一个英语不错的人(我真不要脸)<br>在阅读文献的时候还是会遇见很多很多生词的<br>这些生词是不可能靠日常积累达到全部认识的(好吧我承认我弱)<br>但是,我又非常不喜欢google全文翻译,他可能会曲解原文章的意思,毕竟google翻译再智能,他也只是机器翻译的,不是人翻译的<br>那么,一个划词翻译插件是非常必要的<br>划词,嗯,字面意思<br>我搜寻了很多划词翻译插件,用过很多<br>最后终于找到了这个并且长期使用的chrome插件<br>他就是</p><h1 id="Saladict"><a href="#Saladict" class="headerlink" title="Saladict"></a>Saladict</h1><p>我们来看一下他的使用页面<br><img src="http://cdn.simonyang.club/2018118-QQ%E6%88%AA%E5%9B%BE20181108185539.jpg" alt="2018118-QQ截图20181108185539"><br>炫酷<br>不仅如此,这个插件还可以打开下载的pdf,甚至本地pdf也可以<br><img src="http://cdn.simonyang.club/20181210-QQ%E5%9B%BE%E7%89%8720181210201820.png" alt="20181210-QQ图片20181210201820"><br>利器啊<br>不想试一试吗<br><img src="http://cdn.simonyang.club/20181210-1200px-%E7%9A%AE%E5%8D%A1%E4%B8%98%E4%B9%8B%E6%AD%8C.jpg" alt="20181210-1200px-皮卡丘之歌"></p><p>点击跳转<a href="https://github.com/crimx/ext-saladict/wiki#wiki-footer" target="_blank" rel="noopener">saladict项目地址</a></p>]]></content>
<categories>
<category> share </category>
</categories>
</entry>
<entry>
<title>edu邮箱</title>
<link href="/2018/08/28/2018/edu-mail/"/>
<url>/2018/08/28/2018/edu-mail/</url>
<content type="html"><![CDATA[<p>如果你想要一个edu邮箱<br>如何申请到我们学校的一个edu邮箱来证明自己的学生身份呢<br>喏,在这<br><a href="http://my.swjtu.edu.cn" target="_blank" rel="noopener">西南交通大学邮件系统</a><br><img src="http://cdn.simonyang.club/2018111-QQ%E6%88%AA%E5%9B%BE20181101231828.jpg" alt="2018111-QQ截图20181101231828"><br>注意:学生只能使用my.swjtu.edu.cn后缀<br>如果你第一次进,那么你需要先注册再登陆,但是注册需要校内网或者联通网<br>注册后再登陆就不需要校内网了,祝你好运<br>ps:教职工登陆网站为:<a href="http://home.swjtu.edu.cn" target="_blank" rel="noopener">http://home.swjtu.edu.cn</a><br>edu账户的好处见<a href="https://zhuanlan.zhihu.com/p/22804091" target="_blank" rel="noopener">如何赚回学费!高校edu邮箱完整使用方式! - Yvon Shong的文章 - 知乎</a></p>]]></content>
<categories>
<category> swjtu </category>
</categories>
</entry>
<entry>
<title>《图解密码技术》读后总结</title>
<link href="/2018/05/25/2018/crypto/"/>
<url>/2018/05/25/2018/crypto/</url>
<content type="html"><![CDATA[<h2 id="密码工具箱:"><a href="#密码工具箱:" class="headerlink" title="密码工具箱:"></a>密码工具箱:</h2><ul><li>对称密码 </li><li>公钥密码 </li><li>单向散列函数 </li><li>消息认证码 </li><li>数字签名 </li><li>伪随机数生成器</li></ul><h3 id="对称密码"><a href="#对称密码" class="headerlink" title="对称密码"></a>对称密码</h3><p>用相同的密钥进行加密和解密 </p><p>主要算法 </p><ul><li>DES(不建议使用) </li><li>三重DES(DES-EDE2、DES-EDE3)</li><li>AES 新标准</li></ul><h3 id="分组密码的模式"><a href="#分组密码的模式" class="headerlink" title="分组密码的模式"></a>分组密码的模式</h3><ul><li>ECB模式(不应使用) </li><li>CBC模式(推荐使用) </li><li>CFB模式(推荐CTR代替) </li><li>OFB模式(推荐CTR代替) </li><li>CTR模式(推荐使用)</li></ul><h3 id="公钥密码"><a href="#公钥密码" class="headerlink" title="公钥密码"></a>公钥密码</h3><ul><li>公钥解密,私钥加密,接收者生成公钥和私钥,公钥传给发送者</li><li>RSA算法 主要利用求离散对数的难度和大整数质因数分解的复杂度</li></ul><h3 id="混合密码系统"><a href="#混合密码系统" class="headerlink" title="混合密码系统"></a>混合密码系统</h3><p>利用对称密钥加密消息 用公钥密码加密对称密钥</p><h3 id="单向散列函数"><a href="#单向散列函数" class="headerlink" title="单向散列函数"></a>单向散列函数</h3><ul><li>MD5 </li><li>SHA-1算法 </li></ul><h3 id="消息认证码"><a href="#消息认证码" class="headerlink" title="消息认证码"></a>消息认证码</h3><ul><li>确认完整性并进行认证 </li><li>HMAC算法 </li><li>对称密钥计算MAC值 </li></ul><h3 id="数字签名"><a href="#数字签名" class="headerlink" title="数字签名"></a>数字签名</h3><ul><li>公钥加密生成数字签名 </li><li>私钥解密进行认证 </li><li>对消息的散列值进行签名 </li></ul><h3 id="证书"><a href="#证书" class="headerlink" title="证书"></a>证书</h3><p>为公钥加上数字签名 </p><p>Diffie-Hellman密钥交换 利用有限群的离散对数问题的复杂度</p><h3 id="基于口令的密码"><a href="#基于口令的密码" class="headerlink" title="基于口令的密码"></a>基于口令的密码</h3><p>口令+盐 单向散列函数生成密钥加密密钥</p><h3 id="随机数"><a href="#随机数" class="headerlink" title="随机数"></a>随机数</h3><p>随机性 不可预测性 不可重现性 </p><h3 id="伪随机数生成器"><a href="#伪随机数生成器" class="headerlink" title="伪随机数生成器"></a>伪随机数生成器</h3><ul><li>线性同余法 只具备随机性</li><li>单向散列函数法 具有单向性所以具有不可预测性 </li><li>ANSI X9.17 </li></ul><h3 id="用途总结"><a href="#用途总结" class="headerlink" title="用途总结"></a>用途总结</h3><ul><li>对称密码 机密性的压缩</li><li>公钥密码 机密性的压缩</li><li>单向散列函数 完整性的压缩</li><li>消息认证码 认证的压缩</li><li>数字签名 认证的压缩</li><li>伪随机数生成器 不可预测性的压缩</li></ul><h3 id="综合示例"><a href="#综合示例" class="headerlink" title="综合示例"></a>综合示例</h3><ul><li>完整加密过程<br><img src="https://blog-1254458596.cos.ap-chengdu.myqcloud.com/%E5%8A%A0%E5%AF%86.jpg" alt="加密"></li><li>完整解密过程<br><img src="https://blog-1254458596.cos.ap-chengdu.myqcloud.com/%E8%A7%A3%E5%AF%86.jpg" alt="解密"></li></ul>]]></content>
<categories>
<category> reading notes </category>
</categories>
</entry>
<entry>
<title>生物研究生去处</title>
<link href="/2018/05/20/2018/lab/"/>
<url>/2018/05/20/2018/lab/</url>
<content type="html"><![CDATA[<ul><li><a href="http://bioinfo.au.tsinghua.edu.cn/zh" target="_blank" rel="noopener">清华大学生物信息中心</a></li><li><a href="http://www.nibs.ac.cn/index.php" target="_blank" rel="noopener">北京生命科学研究所</a></li></ul>]]></content>
<categories>
<category> bioinfo </category>
</categories>
</entry>
<entry>
<title>Mirrors and CDNs</title>
<link href="/2018/05/03/2018/mirrors/"/>
<url>/2018/05/03/2018/mirrors/</url>
<content type="html"><![CDATA[<h1 id="企业类"><a href="#企业类" class="headerlink" title="企业类"></a>企业类</h1><ul><li><a href="http://mirrors.sohu.com/" target="_blank" rel="noopener">搜狐开源镜像站</a></li><li><a href="http://mirrors.163.com/" target="_blank" rel="noopener">网易开源镜像站</a></li><li><a href="http://mirrors.yun-idc.com/" target="_blank" rel="noopener">首都在线科技股份有限公司</a></li><li><a href="https://opsx.alibaba.com/mirror" target="_blank" rel="noopener">阿里云开源镜像</a></li><li><a href="http://mirror.lupaworld.com/" target="_blank" rel="noopener">LUPA</a> </li><li><a href="http://centos.bitcomm.cn/" target="_blank" rel="noopener">常州贝特康姆软件技术有限公司</a></li></ul><h1 id="大学类"><a href="#大学类" class="headerlink" title="大学类"></a>大学类</h1><ul><li><a href="http://mirrors.tuna.tsinghua.edu.cn/" target="_blank" rel="noopener">清华大学</a></li><li><a href="http://mirror.dlut.edu.cn/" target="_blank" rel="noopener">大连理工大学</a></li><li><a href="http://mirrors.neusoft.edu.cn/" target="_blank" rel="noopener">大连东软信息学院</a></li><li><a href="http://mirrors.zju.edu.cn/" target="_blank" rel="noopener">浙江大学</a></li><li><a href="http://mirror.lzu.edu.cn/" target="_blank" rel="noopener">兰州大学</a></li><li><a href="http://mirror.bit.edu.cn" target="_blank" rel="noopener">北京理工大学 (IPv4 only)</a> </li><li><a href="http://mirror.bit6.edu.cn" target="_blank" rel="noopener">北京理工大学 (IPv6 only)</a></li><li><a href="http://debian.bjtu.edu.cn" target="_blank" rel="noopener">北京交通大学</a></li><li><a href="http://ftp.sjtu.edu.cn/" target="_blank" rel="noopener">上海交通大学 (IPv4 only)</a> </li><li><a href="http://ftp6.sjtu.edu.cn" target="_blank" rel="noopener">上海交通大学 (IPv6 only)</a> </li><li><a href="http://mirrors.ustc.edu.cn/" target="_blank" rel="noopener">中国科学技术大学</a></li><li><a href="http://mirror.neu.edu.cn/" target="_blank" rel="noopener">东北大学 (IPv4 only)</a> </li><li><a href="http://mirror.neu6.edu.cn/" target="_blank" rel="noopener">东北大学 (IPv6 only)</a> </li><li><a href="http://mirrors.hust.edu.cn/" target="_blank" rel="noopener">华中科技大学</a> </li><li><a href="http://mirrors.cqu.edu.cn/" target="_blank" rel="noopener">重庆大学</a></li></ul><h1 id="PyPi-镜像"><a href="#PyPi-镜像" class="headerlink" title="PyPi 镜像"></a>PyPi 镜像</h1><ul><li><a href="http://pypi.douban.com/" target="_blank" rel="noopener">豆瓣</a> </li></ul><h1 id="RubyGems-镜像"><a href="#RubyGems-镜像" class="headerlink" title="RubyGems 镜像"></a>RubyGems 镜像</h1><ul><li><a href="http://ruby.taobao.org/" target="_blank" rel="noopener">淘宝网</a> </li></ul><h1 id="npm-镜像"><a href="#npm-镜像" class="headerlink" title="npm 镜像"></a>npm 镜像</h1><ul><li><a href="http://cnpmjs.org/" target="_blank" rel="noopener">cnpmjs</a> </li></ul><h1 id="cdn"><a href="#cdn" class="headerlink" title="cdn"></a>cdn</h1><ul><li><a href="http://www.bootcdn.cn/" target="_blank" rel="noopener">bootcdn</a></li><li><a href="https://www.jsdelivr.com/" target="_blank" rel="noopener">Staticfile CDN</a></li><li><a href="https://www.staticfile.org/" target="_blank" rel="noopener">jsDelivr</a></li><li><a href="http://jscdn.upai.com/" target="_blank" rel="noopener">又拍云JS库加速服务</a></li><li><a href="https://cdnjs.com/" target="_blank" rel="noopener">cdnjs</a></li><li><a href="https://www.beecdn.com/" target="_blank" rel="noopener">beecdn</a></li></ul>]]></content>
<categories>
<category> record </category>
</categories>
</entry>
<entry>
<title>My books</title>
<link href="/2018/04/27/2018/books/"/>
<url>/2018/04/27/2018/books/</url>
<content type="html"><![CDATA[<p>机器学习</p><ul><li>数学之美</li><li>稀疏统计学习与应用</li><li>应用随机过程概率模型导论</li><li>数据挖掘导论</li><li>深度学习 中文版(pdf)</li><li>Python数据科学手册(pdf)</li><li>Python机器学习基础教程(pdf)</li><li>机器学习实战(pdf)</li><li>deep learning(English)(pdf)</li><li><a href="https://jakevdp.github.io/PythonDataScienceHandbook/" target="_blank" rel="noopener">python数据科学手册(在线版)(English)</a></li><li><a href="https://github.com/wesm/pydata-book" target="_blank" rel="noopener">利用python进行数据分析(在线版)(English)</a></li></ul><p>数学</p><ul><li>程序员的数学(pdf)</li><li>程序员的数学2概率统计(pdf)</li><li>程序员的数学3线性代数(pdf)</li><li>具体数学-计算机科学基础(pdf)</li><li>统计学七支柱(pdf)</li></ul><p>Python</p><ul><li>Python袖珍指南</li><li>用Python写网络爬虫</li><li>Python数据分析与挖掘实战</li><li>Python数据分析</li><li>Python基础教程(第二版)</li><li>Python编程实战 运用设计模式、并发和程序库创建高质量程序</li><li>编写高质量代码 改善Python程序的91个建议</li><li>Python Cookbook(pdf)</li><li>Flask Web开发:基于Python的Web应用开发实战(pdf)</li><li>Head First Python(pdf)</li><li>Python编程:从入门到实践(pdf)</li><li>Python基础教程(第三版)(pdf)</li><li>Python网络数据采集(pdf)</li><li>流畅的Python(pdf)</li></ul><p>c</p><ul><li>C++ Primer Plus(pdf)</li><li>C和指针(pdf)</li><li>C陷阱与缺陷(pdf)</li><li>C专家编程(pdf)</li><li>Effective C(pdf)</li><li>More Effective C(pdf)</li></ul><p>Java</p><ul><li>Java编程思想</li><li>Head First Java</li></ul><p>Android</p><ul><li>第一行代码——Android(pdf)</li></ul><p>JavaScipt</p><ul><li>JavaScript高级语言程序设计</li><li>你不知道的JavasScript(上卷)</li></ul><p>Nodejs</p><ul><li>深入浅出Node.js</li></ul><p>Haskell</p><ul><li>魔力Haskell</li></ul><p>R</p><ul><li>R语言实战</li><li>ggplot2:数据分析与图形艺术</li></ul><p>算法</p><ul><li>算法(第4版)</li><li>算法导论(pdf)</li></ul><p>网络</p><ul><li>TCP/IP详解卷1:协议</li><li>HTTP_2基础教程(pdf)</li><li>TCP-IP详解卷1:协议(pdf)</li><li>TCP-IP详解卷2:实现(pdf)</li><li>TCP-IP详解卷3:TCP事务协议,HTTP,NNTP和UNIX域协议(pdf)</li><li>图解HTTP(pdf)</li><li>网络是怎样连接的(pdf)</li></ul><p>计算机</p><ul><li>深入理解计算机系统</li><li>计算机程序的构造与解释</li><li>操作系统-精髓与设计原理</li><li>编码 隐匿在计算机软硬件背后的语言</li><li>程序是怎样跑起来的(pdf)</li><li>计算机是怎样跑起来的(pdf)</li></ul><p>设计模式</p><ul><li>Head First 设计模式</li></ul><p>Bioinformatics</p><ul><li>生物信息学(李霞,刘建波)</li><li>生物信息学(陈铭)</li><li>Bioinformatics with Python Cookbook(English)(pdf)</li><li>Bioinformatics Data Skills: Reproducible and Robust Research with Open Source Tools(English)(pdf)</li></ul><p>Linux</p><ul><li>鸟哥的Linux私房菜基础学习篇(第三版)(Kindle)</li></ul><p>数据库</p><ul><li>SQL进阶教程(pdf)</li><li>SQL基础教程(pdf)</li></ul><p>安全</p><ul><li><a href="/2018/05/25/crypto">图解密码技术(图书馆)(已读)</a></li></ul><p>杂</p><ul><li>人工智能简史</li><li>得未曾有</li><li>一个人的朝圣</li><li>春宴</li></ul>]]></content>
<categories>
<category> books </category>
</categories>
</entry>
<entry>
<title>有用的网站</title>
<link href="/2018/04/27/2018/urls/"/>
<url>/2018/04/27/2018/urls/</url>
<content type="html"><![CDATA[<p>网站汇集</p><ul><li><a href="#">云端办公</a></li></ul><p>编程相关</p><ul><li><a href="https://visualgo.net/zh" target="_blank" rel="noopener">数据结构和算法可视化</a></li><li><a href="http://www.pythontutor.com/" target="_blank" rel="noopener">代码运行可视化</a></li><li><a href="https://leetcode-cn.com/" target="_blank" rel="noopener">程序员刷题</a></li><li><a href="http://www.runoob.com/" target="_blank" rel="noopener">菜鸟教程</a></li></ul><p>在线书籍</p><ul><li><a href="https://jakevdp.github.io/PythonDataScienceHandbook/" target="_blank" rel="noopener">Python数据科学手册</a></li><li><a href="https://exacity.github.io/deeplearningbook-chinese/" target="_blank" rel="noopener">深度学习</a></li></ul><p>大数据比赛</p><ul><li><a href="https://tianchi.aliyun.com/" target="_blank" rel="noopener">天池</a></li><li><a href="http://www.pkbigdata.com/" target="_blank" rel="noopener">DataCastle</a></li><li><a href="http://www.datafountain.cn/#/" target="_blank" rel="noopener">DataFountain</a></li><li><a href="https://www.kesci.com/" target="_blank" rel="noopener">科赛网</a></li><li><a href="http://jddc.jd.com/" target="_blank" rel="noopener">京东jddc</a></li><li><a href="http://dianshi.baidu.com/" target="_blank" rel="noopener">点石</a></li></ul><p>工具</p><ul><li><a href="http://bigjpg.com/" target="_blank" rel="noopener">人工智能图片放答</a></li><li><a href="https://www.iloveimg.com/" target="_blank" rel="noopener"></a></li><li><a href="https://www.banwagong8.com/" target="_blank" rel="noopener">搬瓦工</a></li><li><a href="https://www.wondercv.com/" target="_blank" rel="noopener">简历制作</a></li></ul><p>资源</p><ul><li><a href="https://pixabay.com/" target="_blank" rel="noopener">免费高清晰度照片</a></li><li><a href="http://iconfont.cn/" target="_blank" rel="noopener">图标库</a></li><li><a href="http://www.chongbuluo.com/" target="_blank" rel="noopener">虫部落</a></li><li><a href="http://www.btwhat.info/" target="_blank" rel="noopener">Btbook</a></li></ul><p>博客模板</p><ul><li><a href="http://stockholmlanding.select-themes.com/" target="_blank" rel="noopener">stockholm</a></li><li><a href="https://pixelarity.com/" target="_blank" rel="noopener">pixelarity</a></li><li><a href="https://themeskingdom.com/wordpress-themes/" target="_blank" rel="noopener">WordPress Themes</a></li><li><a href="https://html5up.net/" target="_blank" rel="noopener">html5up</a></li><li><a href="http://www.nextdesignweb.com/" target="_blank" rel="noopener">nextdesin</a></li></ul><p>chrome插件</p><ul><li><a href="http://tanqingbo.com/2018/05/27/%E5%AE%9E%E7%94%A8%E4%B8%94%E5%A0%AA%E7%A7%B0%E7%A5%9E%E5%99%A8%E7%9A%84Chrome%E6%8F%92%E4%BB%B6%E6%8E%A8%E8%8D%90/" target="_blank" rel="noopener">汇总</a><br>墙内可用</li><li><a href="https://chrome-extension-downloader.com/" target="_blank" rel="noopener">chrome extension downloader</a></li><li><a href="https://www.chromefor.com/" target="_blank" rel="noopener">chrome for</a><br>思维导图</li><li><a href="https://sketchboard.me" target="_blank" rel="noopener">SketchBoard</a></li></ul><p>按键精灵</p><ul><li><a href="https://www.autohotkey.com/" target="_blank" rel="noopener">按键精灵</a></li></ul><p>pdf及其他文档处理</p><ul><li><a href="https://lightpdf.com/zh/" target="_blank" rel="noopener">lightPDF</a></li><li><a href="https://smallpdf.com/" target="_blank" rel="noopener">smallpdf</a></li></ul><p>实时语音转文字</p><ul><li>[搜狗听写app]</li></ul><p>手机电脑合作</p><ul><li>[袋鼠输入]</li><li>[向日葵远程控制]</li></ul><p>云端办公</p><ul><li><p><a href="https://uzer.me/" target="_blank" rel="noopener">uzer</a></p></li><li><p><a href="https://devdocs.io/" target="_blank" rel="noopener">API文档集合</a></p></li><li><p><a href="https://www.datacamp.com/home" target="_blank" rel="noopener">datacamp</a></p></li></ul><p>艺术二维码 <a href="http://www.9thws.com/" target="_blank" rel="noopener">http://www.9thws.com/</a></p><p>学习</p><ul><li><a href="https://www.coursera.org/" target="_blank" rel="noopener">Coursea</a></li><li><a href="https://open.163.com/" target="_blank" rel="noopener">网易公开课</a></li></ul><p>高清图片搜集</p><ul><li><a href="https://unsplash.com/" target="_blank" rel="noopener">unsplash</a></li><li><a href="https://visualhunt.com/" target="_blank" rel="noopener"></a></li><li><a href="https://www.pexels.com/" target="_blank" rel="noopener"></a></li><li><a href="https://pixabay.com/" target="_blank" rel="noopener"></a></li><li><a href="https://magdeleine.co/" target="_blank" rel="noopener"></a></li><li><a href="http://www.51yuansu.com/" target="_blank" rel="noopener"></a></li><li><a href="https://www.peecheey.com/" target="_blank" rel="noopener"></a></li></ul>]]></content>
<categories>
<category> record </category>
</categories>
</entry>
<entry>
<title>Apache Mod_wsgi Django Anaconda Python3 配置</title>
<link href="/2018/04/27/2018/apache/"/>
<url>/2018/04/27/2018/apache/</url>
<content type="html"><![CDATA[<p><em>本文假设读者具有一定的Linux命令行和python基础</em></p><p>运行环境</p><pre><code>Centos-7.4Anaconda-Python3.6.4Django-2.0.4httpd-2.4.33</code></pre><p>服务器为腾讯云服务器,httpd是Apache中的服务,安装httpd需要依赖apr、apr-util、pcre<br>python选用anaconda并且使用conda虚拟环境</p><h1 id="Apache"><a href="#Apache" class="headerlink" title="Apache"></a>Apache</h1><p>首先安装gcc编译器,gcc为编译必须,c++编译器和expat-devel依赖为pcre安装所必须</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">yum install gcc</span><br><span class="line">yum install gcc-c++</span><br><span class="line">yum install expat-devel</span><br></pre></td></tr></table></figure><p>下载源码安装包,注意当使用apr-util,apr1.6版本编译安装httpd时出现xml错误,在/usr/local/httpd/目录下只有modules文件夹。因此1.6版本不适用于httpd的最新版,因此选用1.5版本</p><p>选用<a href="https://mirrors.tuna.tsinghua.edu.cn/" target="_blank" rel="noopener">清华镜像</a>下载速度更快</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz</span><br><span class="line">wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz</span><br><span class="line">wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz</span><br><span class="line">wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.33.tar.gz</span><br><span class="line">wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.1.0-Linux-x86_64.sh</span><br></pre></td></tr></table></figure><p>解压</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">tar -xzf pcre-8.40.tar.gz</span><br><span class="line">tar -xzf httpd-2.4.33.tar.gz</span><br><span class="line">tar -xzf apr-util-1.5.4.tar.gz</span><br><span class="line">tar -xzf apr-1.5.2.tar.gz</span><br></pre></td></tr></table></figure><p>安装</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">cd apr-1.5.2</span><br><span class="line">./configure --prefix=/usr/local/apr</span><br><span class="line">make</span><br><span class="line">make install</span><br><span class="line"></span><br><span class="line">cd ../apr-util-1.5.4</span><br><span class="line">./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr</span><br><span class="line">make</span><br><span class="line">make install</span><br><span class="line"></span><br><span class="line">cd ../pcre-8.40</span><br><span class="line">./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr</span><br><span class="line"></span><br><span class="line">cd ../httpd-2.4.33</span><br><span class="line">./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util</span><br><span class="line">make </span><br><span class="line">make install </span><br><span class="line"></span><br><span class="line">cd ..</span><br><span class="line">bash Anaconda3-5.1.0-Linux-x86_64.sh</span><br></pre></td></tr></table></figure><p>将Anaconda命令和httpd启动命令添加到path</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/profile</span><br></pre></td></tr></table></figure><p>在最后添加两行</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">export PATH=/usr/local/httpd/bin:$PATH</span><br><span class="line">export PATH=/root/anaconda3/bin:$PATH</span><br></pre></td></tr></table></figure><p>使profile文件起作用</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">. /etc/profile</span><br></pre></td></tr></table></figure><p>注意.和/之间有个空格<br>试一下httpd行不行<br>输入</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">httpd -k start</span><br></pre></td></tr></table></figure><p>访问服务器的ip地址,可以看到页面显示it works</p><p>相应的,重新启动和停止的命令为</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">httpd -k restart</span><br><span class="line">httpd -k stop</span><br></pre></td></tr></table></figure><h1 id="Python-Django"><a href="#Python-Django" class="headerlink" title="Python Django"></a>Python Django</h1><p>下面开始配置python django</p><p>conda添加清华源</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/</span><br><span class="line">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/</span><br><span class="line">conda config --set show_channel_urls yes</span><br></pre></td></tr></table></figure><p>创建django安装的python3.6环境</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">conda create -n django python=3.6</span><br><span class="line">source activate django</span><br><span class="line">pip install django</span><br></pre></td></tr></table></figure><p>安装mod_wsgi</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install mod_wsgi</span><br></pre></td></tr></table></figure><p>获取mod_wsgi</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mod_wsgi-express module-config</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">LoadModule wsgi_module "/root/anaconda3/envs/django/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"</span><br><span class="line">WSGIPythonHome "/root/anaconda3/envs/django"</span><br></pre></td></tr></table></figure><p>修改httpd配置文件</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd /usr/local/httpd/conf</span><br><span class="line">vim httpd.conf</span><br></pre></td></tr></table></figure><p>LoadModule中添加一行</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">LoadModule wsgi_module "/root/anaconda3/envs/django/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"</span><br></pre></td></tr></table></figure><p>将这一行</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Include conf/extra/httpd-vhosts.conf</span><br></pre></td></tr></table></figure><p>取消注释<br>相应的修改httpd-vhosts.conf文件</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd extra</span><br><span class="line">vim httpd-vhosts.conf</span><br></pre></td></tr></table></figure><p>全部注释掉之后添加下面部分</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">WSGIPythonPath /root/anaconda3/envs/django/lib/python3.6/site-packages:/home/website</span><br><span class="line">WSGIPythonHome /root/anaconda3/envs/django</span><br><span class="line"><VirtualHost *:80></span><br><span class="line">DocumentRoot /home/website/website</span><br><span class="line">ServerName localhost:80</span><br><span class="line">ServerAdmin [email protected]</span><br><span class="line"></span><br><span class="line">WSGIScriptAlias / /home/website/website/wsgi.py</span><br><span class="line">Alias /static/ /home/website/static/</span><br><span class="line"><Directory "/home/website"></span><br><span class="line">Require all granted</span><br><span class="line"></Directory></span><br><span class="line"></VirtualHost></span><br></pre></td></tr></table></figure><p>先来看下我django项目的目录结构<br>这是/home/website内的文件树形图(已省略一部分无关内容)</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line">|-- db.sqlite3</span><br><span class="line">|-- manage.py</span><br><span class="line">|-- static</span><br><span class="line">|-- templates</span><br><span class="line">| `-- index.html</span><br><span class="line">|-- website</span><br><span class="line">| |-- __init__.py</span><br><span class="line">| |-- settings.py</span><br><span class="line">| |-- urls.py</span><br><span class="line">| |-- view.py</span><br><span class="line">| `-- wsgi.py</span><br></pre></td></tr></table></figure><p>配置wsgi.py</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">import os</span><br><span class="line">from django.core.wsgi import get_wsgi_application</span><br><span class="line">os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'</span><br><span class="line">os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")</span><br><span class="line">application = get_wsgi_application()</span><br></pre></td></tr></table></figure><p>同时在settings.py中修改这一部分,如果不修改,django会拒绝外部的访问</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ALLOWED_HOSTS = ["your server ip"]</span><br></pre></td></tr></table></figure><p>WSGIPythonPath 取上面mod_wsgi输出的路径的site-packages部分,/home/website是我django网站存放的路径<br>WSGIPythonHome 与上面mod_wsgi输出的相同<br>DocumentRoot 就是django主要文件存放的地方<br>WSGIScriptAlias 将wsgi.py的地址映射为/<br>Alias 将存放静态文件的文件姐映射到/static/<br>Directory是为了提升所需要目录的权限 </p><p>一切就绪之后,重新启动</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">httpd -k restart</span><br></pre></td></tr></table></figure><p>访问域名,发现没成功<br>查看error_log,默认位置在logs内</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /usr/local/httpd/logs/error_log</span><br></pre></td></tr></table></figure><p>可以看到</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Permission denied: mod_wsgi (pid=6696): Unable to stat Python home /root/anaconda3/envs/django. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.</span><br><span class="line">Fatal Python error: Py_Initialize: Unable to get the locale encoding</span><br><span class="line">ModuleNotFoundError: No module named 'encodings'</span><br></pre></td></tr></table></figure><p>表示权限不够。因此提升权限,亲测仅提升anaconda文件夹权限不能解决,因此</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chmod 755 /root</span><br><span class="line">httpd -k start</span><br></pre></td></tr></table></figure><p>访问成功<br>error_log在网站内部代码运行错误时还会存放错误信息,用于查到代码运行中可能出现的bug<br>(注意配置中的所有路径信息,如果其中包含括号,则需要在两侧加上引号)</p>]]></content>
<categories>
<category> server </category>
</categories>
</entry>
<entry>
<title>2018不能忘记</title>
<link href="/2018/04/26/2018/overview/"/>
<url>/2018/04/26/2018/overview/</url>
<content type="html"><![CDATA[<ul><li>2018-03-26 <a href="https://www.zhihu.com/question/61486078" target="_blank" rel="noopener">武汉理工大学 陶崇园坠楼</a></li><li>2018-04-26 <a href="https://www.zhihu.com/question/274459587" target="_blank" rel="noopener">厦门大学 田佳良事件</a> </li><li>2018-04-26 <a href="https://www.zhihu.com/question/274828827" target="_blank" rel="noopener">天津大学 学生体测猝死</a></li><li>2018-04-29 <a href="https://www.zhihu.com/question/275021771" target="_blank" rel="noopener">四川遂宁 男子公交车上殴打小孩</a></li><li>2018-04-28 <a href="https://www.zhihu.com/question/275020131" target="_blank" rel="noopener">淘宝网大面积刊登性别歧视广告</a></li><li>2018-05-03 <a href="https://zhuanlan.zhihu.com/p/36356167" target="_blank" rel="noopener">小米集团 港交所提交招股说明书</a></li><li>2018-05-04 <a href="http://news.sina.com.cn/c/2018-05-05/doc-ifzfkmth9361216.shtml" target="_blank" rel="noopener">北大校长就口误事件道歉:我并不是一个完美的人</a></li><li>2018-05-11 <a href="https://www.zhihu.com/question/276575922/answer/388549186" target="_blank" rel="noopener">空姐搭乘滴滴顺风车被杀害</a></li></ul>]]></content>
<categories>
<category> big event </category>
<category> 2018 </category>
</categories>
</entry>
</search>