The cleaner way is through a simple launchd plist placed in your ~/Library/LaunchAgents folder.
Here's my example:
$ cat ~/Library/LaunchAgents/com.latcarf.loginscript.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.latcarf.loginscript</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/latcarf/Documents/script/loginscript.bash</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
# Start it up
$ launchctl load ~/Library/LaunchAgents/com.latcarf.loginscript.plist
# Or just reboot or logout and back in to kick it off.
# Only runs once at login.





