开发者

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

开发者 https://www.devze.com 2023-04-12 00:18 出处:网络
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.

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

精彩评论

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