Listing 2: Processing words
SplitWords() # target source-list
{
tmp="$1"
shift
eval "$tmp=\"$*\""
}
SplitSep() # target separator source-string
{
OIFS="$IFS"
IFS="$2"
SplitWords $1 $3
IFS="$OIFS"
}
Join() # target join-with source-list
{
target=$1
shift
separator=$1
shift
collect=$1
if [ ! "$1" ]
then
eval $target=
return
fi
shift
for t
do
collect="$collect$separator$t"
done
eval $target=\"$collect\"
}
# End of File
|