Remove shell script and its directory

Hi,

I have shell script which is located in /opt/Test/test.sh

code in test.sh is as follows

#!/bin/sh

rm -rf /opt/Test

exit 0

when I tried to execute the above script from its location, it shows the following error

rm: Cannot remove any directory in the path of the current working directory /opt/Test

can some please suggest any good solution how to remove the script and the direcotry in such case

Thanks in advance
RaghuDeep Amilineni

You could try cd'ing out of the directory first?
Or you could hand off the command to at?

You can do that by one by one.also you can delete a dir. provided it should be an empty dir.
use rmdir ,rm -r etc

this may help u.