Posted on 10-19-2015 05:38 PM
In two weeks I am will be in the CCT course and I am currently getting my feet wet with Casper. I've spent many hours reading discussions here and i've come across a lot of different ways things can get done. I've seen BASH, Perl, Ruby, Python, and AppleScript. Is there really a preference for Casper or is there a "use what you are most comfortable with" mentality. I'm asking because i'd like to focus on one and hone my skills.
Thanks in advance.
Posted on 10-19-2015 06:14 PM
Any scripting language that can run on the client device will work.
Bash is probably the most commonly used one.
But Python is more powerful and becoming more common amongst sys admins
If it was me, I'd be looking to learn Python
Posted on 10-20-2015 02:40 AM
@rtrouton has a pretty good answer for this I think https://forums.developer.apple.com/thread/5283
The bit in question really would be "Use the right tool for the job you're working on"
Posted on 10-20-2015 03:56 AM
I'd have to say bash and Python personally. Not sure if there is a clear winner and the "use the right one for the task" is very true. Python is definitely more powerful at some tasks, but bash has its uses for neat one liners.
Posted on 10-20-2015 04:51 AM
Thanks for the quick responses everyone.
Posted on 10-20-2015 06:17 AM
I would add that focusing on learning the command line tools that will be called in these scripts is most important. If you learn about softwareupdate, csrutil, diskutil, hdiutil, systemsetup, networksetup, dscl, installer, grep, jamf binary, and a few others you will be able to design a script in any language to accomplish your goals.
Another thing to think about is when to script. Personally I am trying to reduce my dependency on scripting and look at what I can accomplish with "Execute Command" in the "Files and Processes" option of casper policies.
This helps with modularity and if you make use of Casper Sites.
Posted on 10-20-2015 06:48 AM
Shell/Bash and then a bit of Python. I am going to take a Python class at General Assembly here in Boston as it is most useful!
Posted on 10-21-2015 12:11 PM
Definitely use what fits the task, and your coding style the best. Bash is always good to have in your arsenal, and the code is more accessible to a wider audience, but others are more powerful.
I'm a rubyist myself, because it fits how I think more comfortably, but the equally-powerful python is more commonly used in the sysadmin world. Perl is still powerful, but unless you already know it, I'd go for ruby or python, both of which were developed (in part) to take the good parts of perl and address the not-so-good ones.
Some Applescript knowledge is also a good thing to have, because regardless of your primary language, there are some tasks that just work better with Applescript, and you can use osascript to execute Applescript snippets from any other language.
Posted on 10-21-2015 01:54 PM
I use bash for pretty much everything, but it's easy enough to use another language for certain things. For example, I needed SMTP to send email notifications in a bash script, and I echo out and run a python script from my bash script just for that function.