简体   繁体   English

bash等待开放完成

[英]bash wait for open to finish

I just asked a question here and it made me think of another. 我刚刚在这里问了一个问题,这让我想到了另一个问题。 Is is possible to get an exit code from whatever editor is opened from the bash command 是否可以从bash命令打开的任何编辑器中获取退出代码

open -t ...

It would be great if i could perform an action after the user had exited the text editor (and also work out if they saved the document while it was open). 如果我可以在用户退出文本编辑器之后执行操作(并且如果他们在文档打开时保存文档也可以解决),那将会很棒。 Is this possible? 这可能吗?

Do you really want the exit code, or just confirmation that the user has exited the text editor? 您真的想要退出代码,还是仅确认用户已退出文本编辑器? The -W option causes open to wait until the editor exits before exiting itself. -W选项导致open等待编辑器退出,然后退出。 The value of $? $的价值? would be, I suspect, the exit code of open , not the editor. 我怀疑,这将是open的退出代码,而不是编辑器。 Since the editor likely is a child process of launchd , not your shell, I'm not sure how you retrieve the exit code of the editor. 由于编辑器可能是launchd的子进程,而不是你的shell,我不知道你是如何检索编辑器的退出代码的。

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

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