简体   繁体   English

从bash脚本中删除OS X中的目录

[英]Delete directory in OS X from bash script

I want to run from bash script this command. 我想从bash脚本运行此命令。

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? 您知道在OS X中删除目录的正确方法是什么吗?

That's not a hyphen in –rf , so Bash thinks that –rf is a filename. 这不是–rf的连字符,因此Bash认为–rf是文件名。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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