qu-14-01_lspids.sh

来自「Berkely的学生写的」· Shell 代码 · 共 34 行

SH
34
字号
#!/bin/sh# Chapter 15 - Answer to Question 1# This function prints out the pid for the named process# On linux/bsd you will need to change the value of $PSCMD# to:##    PSCMD="/bin/ps -auwx"## You will need to "source" this script into your environment# using the . command.lspids() {    USAGE="Usage: lspids [-h] process"    HEADER=false    PSCMD="/bin/ps -ef"    case "$1" in        -h) HEADER=true ; shift ;;    esac    if [ -z "$1" ] ; then        echo $USAGE ;        return 1 ;    fi    if [ "$HEADER" = "true" ] ; then        $PSCMD 2> /dev/null | head -衝 1 ;    fi    $PSCMD 2> /dev/null | grep "$1"| grep -v grep}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?