> > # Usage: exchange varname1 varname2 > > exchange() { > > local tmp > > [[ $1 = *[^[:alnum:]_]* || $1 = [0-9]* ]] && > > { echo "Naughty naughty" >&2; return 1; } > > [[ $2 = *[^[:alnum:]_]* || $2 = [0-9]* ]] && > > { echo "Naughty naughty" >&2; return 1; } > > eval tmp=\$$1 > > eval $1=\$$2 > > eval $2=\$tmp > > return 0 > > }
> Me too, did not found anything wrong. Mind, if I'm going to include > this in my software? Would have to be GPL v3 though. (CREDITS of course > will go to you). Any code I write to a public mailing list is public domain, including this. You may do anything you want with it.