0

Hi I have a shell script in my login item , which runs whenever i log in to my system . It does work completely but once it exits the terminal , it leaves the terminal shortcut on my dock and I don't want that I want my dock to be clean and want only my required application in it.Is there any command which I can keep at the end of my script so that once the script executes completely it also remove terminal from my dock.

3
  • 1
    I think Terminal.app is actually still running and you need to quit it, not modify the Dock. If that’s your issue, Automatically quit Terminal when typing exit should answer your question.
    – Édouard
    Commented Mar 27, 2014 at 10:58
  • Enable it in Preferences , for "exit" command to take effect and quit Terminal
    – wam090
    Commented Mar 27, 2014 at 12:26
  • I already have the exit command at the end of my scripts and also after shell execution the terminal get close but it left the link to re open the terminal i think its a mac feature to left the recent open apps in dock . and i already had set the preferences Commented Mar 27, 2014 at 12:39

1 Answer 1

1

Try to run the script with launchd instead. Save a property list like this as ~/Library/LaunchAgents/some.label.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>some.label</string>
  <key>Program</key>
  <string>/path/to/script</string>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

It should run the script the next time you log in. Make sure the script is executable (chmod +x /path/to/script) and starts with a hashbang line (like #!/usr/bin/env bash).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .