shell是命令语言、命令解释程序及程序设计语言的统称。1.Bash脚本以“#!”开头(文件的首行),而“#!”后面同时要将所使用的shell的路径明确指出。#! /bin/sh2.程序的注释符为“#”。3.命令行中强制执行shell类型#csh myscript4.shell脚本的执行1)设置权限...
分类:
系统相关 时间:
2015-08-12 16:40:51
阅读次数:
144
1.自动判断用户是否存在并添加用户和设置密码#!/bin/bash#设置$1为传递参数user=$1#如果用户不存在,添加并且设置密码;否则,显示其已经存在。! id $1 && useradd $1 && echo "$1" |passwd --stdin $1 ||echo "$1 is exi...
分类:
其他好文 时间:
2015-08-12 13:06:27
阅读次数:
140
只需要完成下面两部,就可以实现在mac osx 下git 命令自动补齐 首先下载自动补齐脚本,使用curl命令如下: curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ...
分类:
其他好文 时间:
2015-08-12 10:25:38
阅读次数:
265
\subsection{Service} 在/usr/local/apache2/conf/httpd.conf中设置ServerName后,接下来可以使用apachectl来启动httpd。 \begin{lstlisting}[language=bash] $ sudo /usr/local/apache2/bin/apachectl start $ ...
分类:
Web程序 时间:
2015-08-12 09:04:54
阅读次数:
116
写法一: ---------------------------------------------------------------------------- #!/bin/bash ? while read line do ?? ?echo $line done < filename(待读取的文件) -----------------------------...
分类:
系统相关 时间:
2015-08-11 23:49:43
阅读次数:
283
getopt命令并不是bash的内建命令,它是由util-linux包提供的外部命令。
getopt 与 getopts 的区别
getopts 是 shell 内建命令, getopt 是一个独立外部工具getopts 使用语法简单,getopt 使用语法复杂getopts 不支持长参数(长选项,如 --option), getopt 支持getopts 不会重排所有参数的顺...
分类:
其他好文 时间:
2015-08-11 23:23:23
阅读次数:
116
signApk.sh#!/bin/bash#$1 signed and unaligned apk#$2 unsigned apk#$3 aligned apk#./signApk.sh test-signed.apk test-unsigned.apk test-aligned.apk ja...
分类:
移动开发 时间:
2015-08-11 22:49:30
阅读次数:
140
前提条件:已经安装python,命令行支持bash在bash_profile中添加function ccolor {python /Users/xirtam/Documents/tools/ccolor.py $1 $2 $3}编写其中的python文件import sysprint(hex(int...
分类:
编程语言 时间:
2015-08-11 20:53:32
阅读次数:
164
bash变量类型:环境变量本地变量(局部变量)位置变量特殊变量本地变量:var=value:作用域为整个bash进程局部变量:localvar=value:作用域为当前代码段环境变量:exportvar=value:作用域为当前shell和其子进程shell位置变量:$1,$2.......特殊变量:$?:上一条命令执行状态返回..
分类:
其他好文 时间:
2015-08-11 19:25:12
阅读次数:
363
脚本:命令的堆砌任何脚本的首行:#!/bin/bash:也就是解释器路径除此之外前面加#号的为注释脚本执行之前要给执行权限:chmod+x文件名bash中实现条件判断:条件测试类型:整数测试字符测试文件测试条件测试表达式:[expression][[expression]]testexpression整数比较:-eq:测试..
分类:
系统相关 时间:
2015-08-11 19:21:57
阅读次数:
137