http://blog.csdn.net/ly21st http://ly21st.blog.chinaunix.net
发布时间:2011-10-14 10:16:14
#!/bin/bashfunction trapper () { echo "In trapper" trap 'echo "Caught in a trap!"' INT # Once set, this trap affects the entire script. Anytime # ^C is entered, the script will ignore it.}while :do echo "In the main script" trapper echo "Still in ma.........【阅读全文】
发布时间:2011-10-14 10:09:59
#!/bin/bash# Scriptname: mainprog# This is the main script that will call the function, addon# datafile=$HOME/bourne/datafile datafile=./datafile source dbfunctions # The file is loaded into memory if [ ! -e $datafile ] then echo "$(basename $datafile) does not ex.........【阅读全文】
发布时间:2011-10-14 10:03:06
#!/bin/bash# Scriptname: do_squarefunction square { local sq # sq is local to the function let "sq=$1 * $1" echo "Number to be squared is $1." echo "The result is $sq "}echo "Give me a number to square. "read numbervalue_returned=$(square $.........【阅读全文】
发布时间:2011-10-14 09:59:44
#!/bin/bash# Scriptname: do_increment increment () { local sum; # sum is known only in this function let "sum=$1 + 1" return $sum # Return the value of sum to the script} echo -n.........【阅读全文】
发布时间:2011-10-14 09:35:17
#!/bin/bash# Scriptname: ttype# Purpose: set the terminal type# Author: Andy AdminCOLUMNS=60LINES=1PS3="Please enter the terminal type: "select choice in wyse50 vt200 xterm sundo case $REPLY in 1) export TERM=$choice echo "TERM=$choice" b.........【阅读全文】