maart@cs.vu.nl (Maarten Litmaath) (12/29/90)
In article <3074@wyse.wyse.com>, bob@wyse.wyse.com (Bob McGowen x4312 dept208) writes: )... ) 3) while [ ! -z "$1" ] ) do ) if [ $# -eq 1 ] ) then ) last=$1 ) shift ) else ) rest="$rest $1" ) shift ) fi ) done How about the following alternative? It works for `funny' arguments too. --------------------cut here-------------------- #!/bin/sh # find the last argument AND reset all arguments but the one found, # using only BUILTIN constructs case $# in 0) echo 'No arguments specified.' >&2 exit 1 esac argv= last= while : do case $# in 1) last=$1 break esac eval i$#=\$1 argv="$argv \"\$i$#\"" shift done eval set x $argv shift echo "last=$last" echo 'new arguments:' for i do echo " $i" done -- nlp@berlin.mt.cs.cmu.edu: "I heard that an Awk was spotted in Sherwood forest." rmk@frog.UUCP (Rick Kelly): "It was seen running in the background."