running a simple shell script on startup in Yosemite
You could save your script whatever you want and call it from a .plist file saved on /Library/LaunchAgents/ to be launched at startup.

Let me explain how to do it with an example.


Create you script and save it on /Users/username/setip.sh.
Create a new file called com.username.setip.plist in /Library/LaunchAgents/. This file must have the following format:


&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;com.username.setip&lt;/string&gt;

  &lt;key&gt;ProgramArguments&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/Users/username/setip.sh&lt;/string&gt;
  &lt;/array&gt;

  &lt;key&gt;Nice&lt;/key&gt;
  &lt;integer&gt;1&lt;/integer&gt;

  &lt;key&gt;StartInterval&lt;/key&gt;
  &lt;integer&gt;60&lt;/integer&gt;

  &lt;key&gt;RunAtLoad&lt;/key&gt;
  &lt;true/&gt;

  &lt;key&gt;StandardErrorPath&lt;/key&gt;
  &lt;string&gt;/tmp/com.username.setip.err&lt;/string&gt;

  &lt;key&gt;StandardOutPath&lt;/key&gt;
  &lt;string&gt;/tmp/com.username.setip.out&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;


The file is pretty self-explanatory. It will launch the command /Users/username/setip.sh every 60 seconds, will be launched at load, will save errors on /tmp/com.username.setip.err and logs on /tmp/com.username.setip.out.

Restart, and the script will be executed.