📄 tty_scan
字号:
#!/bin/sh5########################################################################## Copyright (c) 1988, 1989 by# Digital Equipment Corporation, Maynard, MA# All rights reserved.## This software is furnished under a license and may be used and# copied only in accordance with the terms of such license and# with the inclusion of the above copyright notice. This# software or any other copies thereof may not be provided or# otherwise made available to any other person. No title to and# ownership of the software is hereby transferred. ## The information in this software is subject to change without# notice and should not be construed as a commitment by Digital# Equipment Corporation. ## Digital assumes no responsibility for the use or reliability# of its software on equipment which is not supplied by Digital.## SCCSID = "@(#)tty_scan 4.2 (ULTRIX) 8/5/90"## 000 Jonathan Wallace 1-Jun-1990### 001 James C. Overman 05-Aug-1990# Moved references to /tmp to /usr/tmp # ##########################################################################set -htrap 'exit 1' 1 2 3 18>/usr/tmp/tty_stat#####################################################################: TTY_Status_Routine#####################################################################TTY_Status_Routine(){( set $* shift;shift;shift KEEPER="$*" STATUS=`expr "$KEEPER" : '\(.*\)[#]'` case $? in 0 ) COMMENT=`expr "$KEEPER" : '.*[#]\(.*\)'` ;; 1 ) STATUS="$KEEPER" ;; esac for K in $STATUS do case $K in on ) echo "$COMMENT" > /usr/tmp/tty_stat return 1 ;; * ) ;; esac done return 0)}####################### Main Program Start #######################grep -n "^$1" /etc/ttys >/usr/tmp/tty_linescase $? in1 ) exit 3 ;;esacLINES=`wc -l /usr/tmp/tty_lines` LINES=`expr "$LINES" : '.*\([0-9][0-9]*\)'`case $LINES in1 ) ;;* ) exit 4 ;;esacTTOP=QFLAG=0for K in `cat /usr/tmp/tty_lines`do case $K in *:*) TEMP=`expr $K : '.*[:]\(.*\)'` TTOP="$TTOP $TEMP" ;; \"* ) TTOP="$TTOP $K" QFLAG=1 ;; *\" ) TTOP="$TTOP$K" QFLAG=0 ;; * ) case QFLAG in 1 ) TTOP="$TTOP$K" continue ;; esac TTOP="$TTOP $K" ;; esacdone[ "$TTOP" = "" ] ||{ TTY_Status_Routine $TTOP case $? in 1 ) exit 5 ;; esac}exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -