Peter Penzov
Peter Penzov

Reputation: 1678

Delete directory in OS X from bash script

I want to run from bash script this command.

rm –rf secure_gate

But for some reason I get this error and I can't find why:

rm: –rf: No such file or directory
rm: secure_gate: is a directory

Do you know what is the proper way to delete directory in OS X?

Upvotes: 1

Views: 992

Answers (1)

Benjamin W.
Benjamin W.

Reputation: 52132

That's not a hyphen in –rf, so Bash thinks that –rf is a filename.

If I get the numerical value of the dash copy-pasted from the question, I get

$ printf '%d' "'–"
8211

(en dash) whereas a normal hyphen is

$ printf '%d' "'-"
45

Upvotes: 5

Related Questions