Rm command doesn't work inside shell

I am on OS X 10.9 using terminal.

I am new to shell scripting but managed a (semi) working script.

after creating the test.sparsebundle file and running some other commands, I want to delete the file after I no longer need it.

I am running:

echo "...Removing $FILENAME"
rm –Rf "$FILENAME"

      

the file remains after running this command and the following error is returned:

...Removing test.sparsebundle
rm: –Rf: No such file or directory
rm: test.sparsebundle: is a directory

      

I can't figure out what happened. After the command, I have placed the following lines of code to try a few things.

#TEST SCRIPT INPUT
    TEST_CODE=""
    echo "INPUT TEST CODE \(not deleting sparsebundle\):"
    read -e TEST_CODE
    eval "$TEST_CODE"
#TEST SCRIPT INPUT

      

When I enter the same code as before (rm -Rf "$ FILENAME") via user input, it works. I don't understand why it won't work from my script (file.sh).

Any ideas on how to fix this?

+3


source to share


1 answer


Etan Reisner (above) answered this question.



There was no ascii character in the rm -Rf commands, it is U + 0096.

+1


source







All Articles