Unix script 15 - quick reference
来源:互联网 发布:c语言如何输入n个数 编辑:程序博客网 时间:2024/06/03 19:13
This is a quick reference guide to the meaning of some of the less easilyguessed commands and codes.Command Description Example & Run the previous command in the background&& Logical AND|| Logical OR^ Start of line$ End of line= String equality (cf. -eq)! Logical NOT$$ PID of current shell$! PID of last background command$? exit status of last command$0 Name of current command (as called)$1 Name of current command's first parameter$9 Name of current command's ninth parameter$@ All of current command's parameters (preserving whitespace and quoting)$* All of current command's parameters (not preserving whitespace and quoting)-eq Numeric Equality-ne Numeric Inquality-lt Less Than-le Less Than or Equal-gt Greater Than-ge Greater Than or Equal-z String is zero length-n String is not zero length-nt Newer Than-d Is a Directory-f Is a File-r Is a readable file-w Is a writable file-x Is an executable fileparenthesis:
( ... ) Function definition
ls &
if [ "$foo" -ge "0" ] && [ "$foo" -le "9"]
if [ "$foo" -lt "0" ] || [ "$foo" -gt "9" ]
(not in Bourne shell)grep "^foo"
grep "foo$"
if [ "$foo" = "bar" ]
if [ "$foo" != "bar" ]
echo "my PID = $$"
ls & echo "PID of ls = $!"
ls ; echo "ls returned code $?"
echo "I am $0"
echo "My first argument is $1"
echo "My ninth argument is $9"
echo "My arguments are $@"
echo "My arguments are $*"
if [ "$foo" -eq "9" ]
if [ "$foo" -ne "9" ]
if [ "$foo" -lt "9" ]
if [ "$foo" -le "9" ]
if [ "$foo" -gt "9" ]
if [ "$foo" -ge "9" ]
if [ -z "$foo" ]
if [ -n "$foo" ]
if [ "$file1" -nt "$file2" ]
if [ -d /bin ]
if [ -f /bin/ls ]
if [ -r /bin/ls ]
if [ -w /bin/ls ]
if [ -x /bin/ls ]
( ... )
function myfunc() { echo hello }
- Unix script 15 - quick reference
- Quick Nginx Status Script
- A Quick Reference for Oracle Database 10g RAC on Linux and Unix Platforms
- SQL Quick Reference
- UML Quick Reference
- Chapter 1 Quick Reference
- actionscript quick reference
- DNN - skin quick reference
- VIM QUICK REFERENCE CARD
- LotusScript Language Quick-reference
- Vi Quick Reference
- LVM commands-quick reference
- bash Quick Reference
- XPath Functions Quick Reference
- CCNP Quick Reference
- Python 2.5 Quick Reference
- Emacs Quick Reference
- SVN Quick Reference
- boost 交叉编译(arm)
- html 头部协议 html meta 和 http-equiv 的详解
- 新型大规模先进计算系统关键技术
- C++常见问题
- Eclipse上GIT插件EGIT使用手册之四_配置.gitignore
- Unix script 15 - quick reference
- Win7下IIS由于扩展配置问题而无法提供请求的页
- Unix script 16 - interactive shell
- Struts2接受请求参数
- Unix script 17 - examples
- 关于RHEL6系统时间相差8小时的问题
- Symfony学习文档
- 又说遥控器
- 黑马程序员(C#4)之《几种求1-100之和的方法》