开发者

In bash, what are my options with respect to handling system requests for inputs?

I have a script that contains rm "$STDLOG" &>/dev/null

开发者_运维知识库In the case of the file not existing, I want to proceed, which is why I'm tossing the results.

But I'm not accounting for the case of insufficient permissions, in which case the system asks a question and the script locks up.

Is there a general method for trapping on requests for input?


No. It is your job to instruct the command to either skip (e.g. --interactive=never) or force (e.g. -f) the operation beforehand.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜