[Casper] scripting

Charlie Butters charlie.butters at shopko.com
Fri May 22 13:57:56 PDT 2009


John,

One thing you will definitely need to do is to put double quotes around any
variable that has a value that contains spaces. So for instance, in your
example for kid_pix, you used double quotes when you assigned the value to
kid_pix, but not when you referenced it in your if statement. The if
statement will fail unless you change it to:

if [ -e ³$kid_pix² ]; then

Not sure if that will entirely solve the problem, but it is probably part of
it. Be sure to use double quotes and not single quotes.

Charlie

++++++++++++++++++++++++++++++++++++++++++++++++++

Date: Fri, 22 May 2009 12:37:58 -0400
From: "John McLaughlin" <John_McLaughlin at newton.k12.ma.us>
Subject: [Casper] scripting..
To: "Casper List" <casper at list.jamfsoftware.com>
Message-ID:
    <fc.000f49c2052643dc000f49c2052643dc.52644f0 at newton.k12.ma.us>
Content-Type: text/plain; charset="iso-8859-1"

Hi,
    I'm trying to get my script (which works locally) to deploy over Casper
and it's not.  I'm trying to determine whether there are certain
directories present and, if there are, run a command to install an item
into the dock.  I have used the built-in parameter substitution and I've
tried it without.  In most cases, the script appears to run but does
nothing.  This is a sample of the variations I've tried thus far.

# Application variables
computerName=$2
someapp1=$2/Applications/Something\ I\ Need\ To\ Deploy
someapp2="$2/Applications/Something"
someapp3="$computerName/Applications/Something"



Here is the actual script.

#!/bin/sh


# Applications
kid_pix="/Applications/Kid Pix Deluxe 4"
ttl="/Applications/Type To Learn 3"
kidspiration="/Applications/Kidspiration 2"
inspiration="/Applications/Inspiration 8"


if [ -e $kid_pix ]; then
defaults write com.apple.dock persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString
</key><string>/Applications/Kid
Pix Deluxe 4/Kid Pix Deluxe
4/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></di
ct>"
fi

if [ -e $kidspiration ]; then
defaults write com.apple.dock persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString
</key><string>/Applications/Kidspiration
2/Kidspiration
2.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict>
</dict>"
fi

if [ -e $inspiration ]; then
defaults write com.apple.dock persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString
</key><string>/Applications/Inspiration
8/Inspiration
8.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict>
</dict>"
fi

if [ -e $ttl ]; then
defaults write com.apple.dock persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString
</key><string>/Applications/Type
To Learn 3/Type To Learn
3/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></di
ct>"
fi

killall Dock


exit 0



John McLaughlin
Technical Support Specialist
Newton Public Schools


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090522/c6920df0/attachment.htm 


More information about the Casper mailing list