Using rm * (wildcard) in envoy: No such file or directory

我们两清 提交于 2019-12-05 08:16:59

On UNIX, it's up to the shell to interpret wildcards like *. If you execute a program and pass an argument with * in it directly to the program -- which is presumably what's being done here -- then you'll get an error like you're seeing. rm just assumes the * is a file name, and indeed, it's actually possible to create such a file.

One solution could be to execute the shell and let it execute your command on your behalf, something like

r = envoy.run('sh -c "rm /tmp/my_silly_directory/*"')

The shell will interpret the * before invoking rm.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!