Cover V06, I04
Article
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5

apr97.tar


Listing 1: Processing lists

GetFirstWord()                  # target list
{
eval $1=\"$2\"
}

GetFirstWord head $pathparts

GetLastWord() # target source-list
{
tmp=$1
shift
while true
do
case "$#" in
0) eval "$tmp="; return ;;
?) eval "$tmp=\$$#"; return ;;
??) shift 9 ;;
???) shift 99 ;;
*) shift 999 ;;
esac
done
}

ListDel()                       # target remove source-list
{
t1="$1"
shift
t2="$1"
shift
unset t3
for t
do
[ "$t" = "$t2" ] || t3="$t3 $t"
done
eval $t1=\"$t3\"
}

GetAllButLastWord()             # target join-with source-list
{
target=$1
shift
separator=$1
shift
collect=$1
shift
next=$1
shift
for t
do
collect="$collect$separator$next"
next=$t
done
eval $target=\"$collect\"
}

# End of File