http://blog.csdn.net/ly21st http://ly21st.blog.chinaunix.net
发布时间:2011-10-13 17:23:27
#!/bin/ksh# Scriptname: trapping# Script to illustrate the trap command and signals# Can use the signal numbers or ksh abbreviations seen# below. Cannot use SIGINT, SIGQUIT, etc.trap 'print "Control-C will not terminate $PROGRAM."' INTtrap 'print "Control-\ will not terminate $PROGRAM."' QUI.........【阅读全文】
发布时间:2011-10-13 16:42:20
#!/bin/ksh# Program opts4# Using getopts -- Fourth try --alias USAGE='print "usage: opts4 [-x] filename " >&2'while getopts :x: arguments docase $arguments in x) print "$OPTARG is the name of the argument ";; :) print "Please enter an argumen.........【阅读全文】
发布时间:2011-10-13 16:01:50
#!/bin/ksh# Scriptname: mycalculator# A simple calculator -- uses the bc command to perform the # calculations# Since the shell performs operations on integers only, # this program allows# you to use floating point numbers by writing to and reading # from the bcprogram.cat << EOF******.........【阅读全文】
发布时间:2011-10-13 15:30:46
#!/bin/kshfunction trapper { print "In trapper" trap 'print "Caught in a trap!"' INT print "Got here." sleep 25}while :do print "In the main script" trapper # Call the function print "Still in main" sleep 5 print "Bye"do.........【阅读全文】
发布时间:2011-10-13 15:15:37
# Scriptname: do_square#!/bin/kshfunction square { (( sq = $1 * $1 )) print "Number to be squared is $1." print "The result is $sq "}read number?"Give me a number to square. "value_returned=$(square $number)print $value_returned......【阅读全文】