本文共 3219 字,大约阅读时间需要 10 分钟。
本文通过网络文章来体会下shell中对文件的操作
” #!/bin/sh
myPath=”/var/log/httpd/” myFile=”/var /log/httpd/access.log””这里的-x 参数判断$myPath是否存在并且是否具有可执行权限
if [ ! -x “ myPath”];thenmkdir“ myPath”
fi”# 这里的-d 参数判断$myPath是否存在,如果不存在则进行创建
if [ ! -d “ myPath”];thenmkdir“ myPath”
fi”# 这里的-f参数判断$myFile是否存在
if [ ! -f “ myFile”];thentouch“ myFile”
fi”# 其他参数还有-n,-n是判断一个变量是否是否有值
if [ ! -n “ myVar”];thenecho“ myVar is empty” exit 0 fi”# 两个变量判断是否相等
if [ “ var1"=" var2” ]; then echo ‘ var1eq var2’ else echo ‘ var1noteq var2’ fimyfile=”/home/qatest/abc.txt”
[ -r “ myfile”]||echo“cannotreadabc.txt”;exit1;echo“ myfile is from: ” grep “^first ” $myfileConditional Logic on Files
-a file exists.
-b file exists and is a block special file. -c file exists and is a character special file. -d file exists and is a directory. -e file exists (just the same as -a). -f file exists and is a regular file. -g file exists and has its setgid(2) bit set. -G file exists and has the same group ID as this process. -k file exists and has its sticky bit set. -L file exists and is a symbolic link. -n string length is not zero. -o Named option is set on. -O file exists and is owned by the user ID of this process. -p file exists and is a first in, first out (FIFO) special file or named pipe. -r file exists and is readable by the current process. -s file exists and has a size greater than zero. -S file exists and is a socket. -t file descriptor number fildes is open and associated with a terminal device. -u file exists and has its setuid(2) bit set. -w file exists and is writable by the current process. -x file exists and is executable by the current process. -z string length is zero.Ctrl + B
Ctrl + I
Ctrl + Q
Ctrl + L
Ctrl + K
Ctrl + G
Ctrl + H
Ctrl + O
Ctrl + U
Ctrl + R
Ctrl + Z
Ctrl + Y
Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面。 ——
使用简单的符号标识不同的标题,将某些文字标记为粗体或者斜体,创建一个等,详细语法参考帮助?。
本编辑器支持 Markdown Extra , 扩展了很多好用的功能。具体请参考.
Markdown Extra 表格语法:
项目 | 价格 |
---|---|
Computer | $1600 |
Phone | $12 |
Pipe | $1 |
可以使用冒号来定义对齐方式:
项目 | 价格 | 数量 |
---|---|---|
Computer | 1600 元 | 5 |
Phone | 12 元 | 12 |
Pipe | 1 元 | 234 |
定义 D
定义D内容
代码块语法遵循标准markdown代码,例如:
@requires_authorizationdef somefunc(param1='', param2=0): '''A docstring''' if param1 > param2: # interesting print 'Greater' return (param2 - param1 + 1) or Noneclass SomeClass: pass>>> message = '''interpreter... prompt'''
生成一个脚注.
用 [TOC]
来生成目录:
使用MathJax渲染LaTex 数学公式,详见.
更多LaTex语法请参考 .
可以渲染序列图:
或者流程图:
即使用户在没有网络的情况下,也可以通过本编辑器离线写博客(直接在曾经使用过的浏览器中输入即可。Markdown编辑器使用浏览器离线存储将内容保存在本地。
用户写博客的过程中,内容实时保存在浏览器缓存中,在用户关闭浏览器或者其它异常情况下,内容不会丢失。用户再次打开浏览器时,会显示上次用户正在编辑的没有发表的内容。
博客发表后,本地缓存将被删除。
用户可以选择 把正在写的博客保存到服务器草稿箱,即使换浏览器或者清除缓存,内容也不会丢失。
注意:虽然浏览器存储大部分时候都比较可靠,但为了您的数据安全,在联网后,请务必及时发表或者保存到服务器草稿箱。
转载地址:http://rlcci.baihongyu.com/