next up previous
Next: ぐ或Τ弧 $PATH 柑ぃ '.' ㎡ Up: 厩穦拜膀セ拜肈 Previous:  shell い璶ノ妓 pattern ㄓボ埃 "." 籔 ".."

 Bourne shell script 柑璶或т程把计

パ Martin Weitzel <@mikros.systemware.de:martin@mwtech.uucp> ㎝ Maarten Litmaath <maart@nat.vu.nl> 矗ㄑ氮

璝絋﹚把计ぃ穦禬筁杠ノ

	        eval last=\${$#}

才 POSIX 夹非 shell 柑ぃ恨Τぶ把计常ノ瓃よ猭

┏よ猭琌﹚Τノ

	        for last
        	do
	                :
	        done

┦暗猭琌:

	        for i
	        do
	                third_last=$second_last
	                second_last=$last
	                last=$i
	        done
璝稱暗琌盢程把计埃┪琌盢帮把计抖は筁ㄓ┪琌ノ 材 N 把计┏琌ぃノ硑 subprocess ノ shell ず 暗猭
        t0= u0= rest='1 2 3 4 5 6 7 8 9' argv=

        for h in '' $rest
        do
                for t in "$t0" $rest
                do
                        for u in $u0 $rest
                        do
                                case $# in
                                0)
                                        break 3
                                esac
                                eval argv$h$t$u=\$1
                                argv="$argv \"\$argv$h$t$u\""   # (1)
                                shift
                        done
                        u0=0
                done
                t0=0
        done

        # now restore the arguments
        eval set x "$argv"                                      # (2)
        shift
硂ㄒノ 999 把计莱赣镑ノ灿(1)籔(2)夹ボ よ稱快猭弧狝ぃ恨把计柑Τぐ或┣じ硂ㄢ︽常ぃ穦 畉岿

璶т材 N 把计ノ

	        eval argN=\$argv$N

璶盢把计抖は筁ㄓ夹ボ(1)ê︽ゲ斗эΘ

	        argv="\"\$argv$h$t$u\" $argv"
絤策程把计埃よ猭

璝す砛㊣场硂摸硑 subprocess 暗猭粁碞快 ┏琌т argvN

	        N=1

	        for i
	        do
	                eval argv$N=\$i
	                N=`expr $N + 1`
	        done
璶盢把计抖は筁ㄓ临Τぃノ硑 subprocessΤ虏虫よ猭 硂よ猭ノㄓ埃程把计 ぃ筁璶猔種琌 argvN ぃ琌 ㄓ材 N 把计
        argv=

        for i
        do
                eval argv$#=\$i
                argv="\"\$argv$#\" $argv"
                shift
        done

        eval set x "$argv"
        shift



Tan Koan-Sin
1999-03-02