Closed jaltonen closed 2 years ago
damn, it sure was hard to get the back ticks to show up in the comment field
Could you show the whole launch agent and script (if using a script).
AGENT:
<?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>edu.vcu.sota.dockfixer</string>
<key>ProgramArguments</key>
<array>
<string>/Library/Scripts/dockfixer.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
SCRIPT:
doit=`/usr/local/bin/dockutil --add /Users/$USER/Downloads --display folder --section others
`
exit 0
Yeah I don't understand why the backticks would make a difference unless $USER isn't set except in subshells, but that seems odd.
You could log $USER or the whole command.
And turn on verbose and log the output of dockutil.
Another workaround would be to use ~/Downloads.
Kyle
Sent from Mobile
On Jul 5, 2016, at 8:42 AM, JohnAltonen notifications@github.com wrote:
AGENT:
<?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">
Label edu.vcu.sota.dockfixer ProgramArguments
/Library/Scripts/dockfixer.sh
RunAtLoad
SCRIPT:
!/bin/bash
doit=/usr/local/bin/dockutil --add /Users/$USER/Downloads --display folder --section others exit 0
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
tried all that, logging $USER, current_user=$(stat -f '%Su' /dev/console), using ~/Downloads, no worky. Is it just me ? This is working for others ? Trigger with an agent, agent/script ?
Its working with the backticks so i'll go with that.
This is a shell script issue and backticks or the equivalent are needed if executed this way. Closing this while doing housekeeping of issues.
I feel like I used dockutil in agents in the 10.9 days. Went to use from an agent with 2.0.2 and 10.11 and could not get it to work. Upgraded to 2.0.3 still not working. Tried umpteen variations of how to identify the currently logged in user in the script, never could get it to work. During troubleshooting i figured out i could get the dockutil statement to work in a LaunchAgent if i assigned the statement to a variable
this does not work /usr/local/bin/dockutil --add /Users/$USER/Downloads --display folder --section others
for reasons i don't understand this does work
doit=
/usr/local/bin/dockutil --add /Users/$USER/Downloads --display folder --section others