zoukankan      html  css  js  c++  java
  • shell

    1,shell语法不像c的简洁明快,很多犄角地方让人难受,而且给我的感觉是其数量庞大,永远也学不完。我的态度是学尽少的语法,把它用到极致。这是我.bashrc里的两行,光看if就两种用法,你怕不怕...其实还不止这两种。

    if 
        ps -e|grep eyefoo>>/dev/null        #命令执行成功执行then            
    then
        true                      #相当于汇编的nop
        #echo eyefoo already running
    else
        #echo "no eyefoo-proc running now,start ~/software/eyefoo/eyefoo"
        nohup    ~/software/eyefoo/eyefoo&>>/dev/null
    fi
    
    if [ $(ps -e|grep bash|wc -l) -gt 1 ] ; then     #你注意到每,左[和右]两边是空格,这也是shell的语法...
        true
    else
        xmodmap ~/.xmodmap-`uname -n`
    fi

     2,想让某个路径下的程序后台静默运行,要这像样写:nohup    ~/software/eyefoo/eyefoo& >>/dev/null

    如果写成nohup    ~/software/eyefoo/eyefoo&>>/dev/null  (注意&后面没有空格),是无效的。

  • 相关阅读:
    安装AD域时,出现NetBIOS名称冲突?
    SharePoint Server 2010 安装图解
    Visual C++ 2011519
    Visual C++ 2011520
    Visual C++ 2011518
    Visual C++ 2011520
    设计模式创建型 C++版本
    线程条件变量,一次性初始化
    Visual C++ 2011526
    Visual C++ 2011512
  • 原文地址:https://www.cnblogs.com/weiweishuo/p/2951152.html
Copyright © 2011-2022 走看看