The related article about to recently study --2008,07,31

#-------------------------------------------------------------------first, 2008/07/31-----------------------------------------------------------------------#

1.  if condition expression usage in linux shell 
    –b 当file存在并且是块文件时返回真 
    -c 当file存在并且是字符文件时返回真 
    -d 当pathname存在并且是一个目录时返回真 
    -e 当pathname指定的文件或目录存在时返回真 
    -f 当file存在并且是正规文件时返回真 
    -g 当由pathname指定的文件或目录存在并且设置了SGID位时返回为真 
    -h 当file存在并且是符号链接文件时返回真,该选项在一些老系统上无效 
    -k 当由pathname指定的文件或目录存在并且设置了“粘滞”位时返回真 
    -p 当file存在并且是命令管道时返回为真 
    -r 当由pathname指定的文件或目录存在并且可读时返回为真 
    -s 当file存在文件大小大于0时返回真 
    -u 当由pathname指定的文件或目录存在并且设置了SUID位时返回真 
    -w 当由pathname指定的文件或目录存在并且可执行时返回真。一个目录为了它的内容被访问必然是可执行的。 
    -o 当由pathname指定的文件或目录存在并且被子当前进程的有效用户ID所指定的用户拥有时返回真。 
    UNIX Shell 里面比较字符写法:

    -eq   等于 
    -ne    不等于 
    -gt    大于 
    -lt    小于 
    -le    小于等于 
    -ge   大于等于 
    -z    空串 
    =     两个字符相等 
    !=    两个字符不等 
    -n    非空串 


2. CP --REPLY=YES   you can override the old file that you don't input the 'y' to confirm it


3. the command echo -n ,the parameter -n means that when finished input one colomn , it will not change the colomn automatically (不会自动换行)

 

4. echo "$variable" if you input the command just like it ,you will be right ,but if you input echo $line, you will get the wrong result

 

5. in the awk application, if you call a certain function ,you want to get the return result ,pls use $? ,such as

     if[ $? -eq 1]; then

    echo"you win"

    fi

 

6. if you want to query all rpm package whether be existence in you pc, input the 'rpm -qa|grep package name'

 

7有时候变量名很容易与其他文字混淆,比如:
    num=2
    echo "this is the $numnd"
    这并不会打印出"this is the 2nd",而仅仅打印"this is the ",因为shell会去搜索变量numnd的值,但是这个变量时没有值的。可以使用花括号来告诉shell我们要打印的是num变量: 
    num=2
echo "this is the ${num}nd"
这将打印: this is the 2nd

 

7 重定向:将命令的结果输出到文件,而不是标准输出(屏幕)。
> 写入文件并覆盖旧文件
>> 加到文件的尾部,保留旧文件内容。
http://www.matrix.org.cn/thread.shtml?topicId=35839&forumId=44&fid=44

8 echo "$old_gwapp_list", "$line"
     output more variable in the awk shell

9 rpm package install command explaination :http://www.blog.sh/user1/4375/78438.html

RPM命令详解(转载)

    rpm 常用命令
        1.安装一个包 
            # rpm -ivh

        2.升级一个包 
            # rpm -Uvh

        3.移走一个包 
            # rpm -e

        4.安装参数 
            --force 即使覆盖属于其它包的文件也强迫安装 
            --nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。

        5.查询一个包是否被安装 
            # rpm -q < rpm package name>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值