UNIX[1].shell范例精解(第4版)_code

源代码在线查看: trap.err

软件大小: 124 K
上传用户: snalina
关键词: shell UNIX code 范例
下载地址: 免注册下载 普通下载 VIP

相关代码

				#!/bin/ksh				# This trap checks for any command that exits with a non-zero 				# status and then prints the message -- Korn shell								trap 'print "You gave me a non-integer. Try again. "' ERR				typeset -i number     # Assignment to number must be integer				while true				do				    print -n "Enter an integer. " 				    read -r number 2> /dev/null				    if (( $? == 0 ))     # Was an integer read in? 				    then                 # Was the exit status zero?				        break 				    fi				done				trap - ERR           # Unset pseudo trap for ERR				n=$number				if grep ZOMBIE /etc/passwd > /dev/null 2>&1				then				 	:  				else				    print "\$n is $n. So long"				fi							

相关资源