简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM