zoukankan      html  css  js  c++  java
  • ps -ef |grep -v 在shell sh 脚本中貌似无效?

    想通过ps -ef |grep erdp_ |awk '{print $2}' 获取 erdp_ 开头的进程id, 执行在终端环境下执行是ok的,但是在 sh 脚本里面竟然多出了 两个

    root 11400 4280 0 17:08 pts/5 00:00:00 /bin/bash ./kill.sh erdp_system_app

    root 11401 11400 0 17:08 pts/5 00:00:00 /bin/bash ./kill.sh erdp_system_app

    root 11403 11401 0 17:08 pts/5 00:00:00 grep erdp_system_app

    root 29942 1 3 12:22 pts/0 00:10:10 java -Xms512m -Xmx512m -Dfile.encoding=UTF-8 -DSERVER_PORT=8082 -jar erdp_system_app-2.0.0-SNAPSHOT.war linkServerPId

    ps -ef |grep erdp_ |awk '{print $2}' | grep -v 可以过来 第三行, 但是 前面两行是怎么出现的呢?

    不管怎么样, 通过下面的命令就好了:

    ps -ef |grep erdp_  |  grep -v | grep -v 文件名

    或者:

    ps -ef |grep erdp_  | grep -vE '(grep|/bin/bash)'

  • 相关阅读:
    linux下base命令
    lldpd-0.7.7代码解读(send_pdu部分)
    openwrt 包makefile
    字符
    AC_CONFIG_HEADER
    大小端
    查看使用了那种shell
    debia下安装libjpeg
    工作流模式 (zhuan)
    1.2.1 工作流管理系统参考模型 (zhuan)
  • 原文地址:https://www.cnblogs.com/FlyAway2013/p/10858028.html
Copyright © 2011-2022 走看看