I am making a simple shell script, I need to test for a directory, if it is there, delete it and create a new one, if it is not there, create it.
this is what I have so far:
if ( ! -d /numbers ); then
        echo "does not exist, creating directory"
        sleep 3s
        mkdir numbers
        echo "Directory created."
else
        echo "Removing existing directory and creating a new one"
        sleep 2s
        rmdir numbers
        echo "directory removed"
        sleep 1s
        mkdir numbers
        echo "Directory created"
fi
but this gives me an error message:
myscript.sh: line 17: -d: command not found
and if the directory is there:
mkdir: cannot create directory `numbers': File exists
 
     
    