Skip to main content
Question

Scripting Language preference


Forum|alt.badge.img+4

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.

Forum|alt.badge.img+10
  • New Contributor
  • October 20, 2015

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


charliwest
Forum|alt.badge.img+9
  • Contributor
  • October 20, 2015

@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"


Forum|alt.badge.img+18
  • Valued Contributor
  • October 20, 2015

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.


Forum|alt.badge.img+4
  • Contributor
  • October 20, 2015

Thanks for the quick responses everyone.


Forum|alt.badge.img+16
  • Valued Contributor
  • October 20, 2015

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.


Forum|alt.badge.img+18
  • Honored Contributor
  • October 20, 2015

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!


Forum|alt.badge.img+13
  • Contributor
  • October 21, 2015

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.


Forum|alt.badge.img+17
  • Contributor
  • October 21, 2015

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings