Skip to main content

Hello,



This is a really bad question, I know... but how do you run a script
with arguments through a policy? For instance, I'm running the removal
script for Symantec Anti-Virus and need to supply some flags to the script.
I see you can add custom parameters, but those are different I'd assume
than what I'm looking for.



Thank you,
Ken

Nope, that’s right where you want to be. Those parameters are passed as variables $4, $5, etc to the script. If you need a sample, take a look at the Resource Kit for how they are using these parameters with their “mountNetworkShare.sh” script.



James Fuller | Technology Application Services | application developer II | V: 206.318.7153


I'm not sure if that's what I'm looking for... that looks to be if you are
wanting to populate a variable within the script itself. I want to pass
arguments... for instance:



I want to run runme.sh which is on the dist points. When running this
policy, I want it to actually run the command "runme.sh -a -b -c".



I suppose I could wrap this in a package... plop the script down on disk
somewhere and as a postflight run the script with the correct arguments. I
would assume though that there is a more elegant way of doing this.



Thanks,
Ken


You could always set your own variables in a source file. This comes in
useful when you need a set of hard coded variables that multiple scripts
can source.



Right at the top of your script you can source it, like this



#!/bin/bash



source /Volumes/CasperShare/Scripts/globalvariables.sh



Then all scripts in the future can source those hard coded values. I
know you can set parameters with the Jamf binary but I have honestly
never tried that. I would be interested to know how it works out if you
do go that route.



-Tom


Reply