在登录Mac上运行脚本 [英] Running script upon login mac
问题描述
我想知道,如果有人能够帮助我得到一个sh文件,当我登录到我的帐户,我的电脑上运行。我运行Mac OS X 10.6.7。
I am wondering if anyone is able to help me out with getting a .sh file to run when I log in to my account on my computer. I am running Mac OS X 10.6.7.
我有一个文件Example.sh,我想,当我登录到我的计算机上运行。我没有运行它时,我已经登录的一个问题,但我想这个自动运行。
I have a file "Example.sh" that I want to run when I log onto my computer. I do not have a problem running it when I am already logged in, but I want this to run automatically.
人们都在说将其添加到登录shell文件中,但我不知道那是。一些帮助,请。
People are saying to add it to the login shell file, but I do not know where that is. Some help please.
推荐答案
您可以:
- 启动Automator.app </ li>
- 选择应用程序
- 单击工具栏上的显示库(如果隐藏)
- 添加运行shell脚本(从操作/实用程序)
- 复制和放大器;你的脚本粘贴到窗口
- 测试它
-
保存的地方,例如,你可以使一个应用程序文件夹中HOME(你会得到一个your_name.app)
- start Automator.app
- Select "Application"
- click "Show library" in the toolbar (if hidden)
- Add "Run shell script" (from the Actions/Utilities)
- Copy&paste your script into the window
- Test it
Save somewhere, for example you can make an "Applications" folder in your HOME (you will get an your_name.app)
进入系统preferences - >账户 - >登录项
Go to System Preferences -> Accounts -> Login items
编辑:
的最近我赢得了这个答案是好回答徽章。虽然我的办法很简单,工作,运行在用户登录时任何程序或shell脚本最干净的方式 @ trisweb的答案一描述> 的除非,你想交互
使用Automator的解决方案,你可以做这样的事情下一篇:
With automator solution you can do things like next:
在登录时左右,要求运行一个脚本或退出程序,询问密码,运行在用户登录时的Automator等工作流程,有条件地运行应用程序等等...
so, asking to run a script or quit the app, asking passwords, running other automator workflows at login time, conditionally run applications at login time and so on...
这篇关于在登录Mac上运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!