$ip is a numerical value and not a string. Try assembling the entire SHELL command as a string first. I wrote a FAQ on the use of SHELL.

Why do you even need to SHELL out when KiX has a DEL command?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.