Your SlideShare is downloading. ×
  • Like
Shell scripting with f
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Shell scripting with f


The slide deck from my talk at CodeStock 2012

The slide deck from my talk at CodeStock 2012

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Onorio CatenacciShell Scripting With F#
  • 2. CodeStock is proudly partnered with: RecruitWise and Staff with Excellence - Send instant feedback on this session via Twitter: Send a direct message with the room number to @CodeStock d codestock 401 This session is great! For more information on sending feedback using Twitter while at CodeStock, please see the “CodeStock README” in your CodeStock guide.
  • 3. what we do consulting training design debuggingwho we are Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – our mission is to help our customers achieve their goals through advanced software-based consulting and training we do it Training • On-site instructor-led training Consulting & Debugging • Virtual instructor-led training • Architecture, analysis, and design services • Devscovery conferences • Full lifecycle custom software development • Content creation Design • Project management • User Experience Design • Debugging & performance tuning • Visual & Content Design • Video & Animation Production
  • 4. • What We’ll Discuss – Important BackgroundShell Scripting With F# – Use cases – Code – Additional resources
  • 5. • Important Background – Shell Scripting • Want It LightweightShell Scripting With F# – Rapid testing/prototyping – REPL • Often driving apps via command-line • Want One Language For All • Shell Scripting Languages – Cmd – VBScript – Powershell – Bash
  • 6. • Important Background – Functional Programming Immutable data by default (ex. 1, 2)Shell Scripting With F# • • Lambda functions (ex. 3) • Functions are “first class” (ex. 4,5,6) • Currying/partial application vs. tupled parameters (ex. 7,8, 9) • Unit type (ex. 10) • All functions return a value
  • 7. • Important Background – F# • ML language familyShell Scripting With F# – Standard ML – OCaml • Indentation sensitive by default • Types of values are inferred from usage • Some/None • |> (Pipe Forward) • All funcs must be declared before use
  • 8. • Why Write A Shell Script? – Wrap functionality which you can’t changeShell Scripting With F# – Automate common operations – Large batch jobs
  • 9. • Why Use F# For Shell Scripting? – One language which scalesShell Scripting With F# – Low ceremony • Type inference – Default immutability – Good way to practice FP – Free to choose your own for shell scripting
  • 10. • Code – Command Line • "C:Program Files (x86)MicrosoftShell Scripting With F# F#v4.0Fsi.exe" --exec <name of .fsx> <args> • Args are passed as array of strings • args.[0] is name of script; actual args start at args.[1] • Last line of fsx invokes main func and passes commandline args: – main fsi.CommandLineArgs;;
  • 11. • Additional Resources – Chris Smith’s “Scripting In F#”Shell Scripting With F# • 12/scripting-in-f.aspx – Programming F# 3.0 • Chapter on F# Shell Scripting and Common Idioms – Fake (F# Make Files) (Steffen Forkmann) • – Finnikin (F# Shell Scripting Utility Library) •