如何告诉 OS X 不要“等待”在 bash 脚本中?
我已经设置了这个脚本:
#!/bin/bash /Applications/NameChanger.app/Contents/MacOS/NameChanger "$@" osascript -e "delay 1" -e "tell application \"NameChanger\" to activate"
我用它来将文件名传递给 NameChanager。如果没有第二行,它会加载 NameChanger 而不聚焦。我想我应该使用延迟,然后用 applescript 激活以使其集中。
不幸的是,该脚本正在“等待”NameChanger 运行,然后在执行 applescript 位之前退出。我怎样才能改变这一点?
I've set up this script:
#!/bin/bash /Applications/NameChanger.app/Contents/MacOS/NameChanger "$@" osascript -e "delay 1" -e "tell application \"NameChanger\" to activate"
I'm using it to pass file names to NameChanager. Without the second line it loads NameChanger unfocused. I thought I should use a delay and then activate with applescript to get it focused.
Unfortunately the script is "waiting" for NameChanger to run and then to exit before executing the applescript bit. How can I change that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者,您可以使用打开 命令启动 NameChanger。这也会自动将 NameChanger 带到前台:
Alternatively you can use the open command to launch NameChanger. This should also automatically bring NameChanger to the foreground:
在要在后台运行的 shell 脚本中的命令末尾附加
&
。Append a
&
at the end of commands in a shell script that you want to run in the background.