Scripting Classroomnotes 27/Apr/2023



What is Scripting and How is it different from programming?

  • Every scripting language is a Programming Language, The one theoritical difference is programming languages are compile and then executed where as scripting languages donot have extra compilation step.

Live Example

  • We have written two programs
  • shell script
trap "rm -f $tempfile" EXIT

cat << 'EOF' > $tempfile
    { sum += $4 }
END { mb = sum/1024
      gb = mb/1024
      printf "%.0f MB (%.2fGB) of availble diskspace\n", mb, gb

df -k | awk -f $tempfile
exit 0

  • Python script
#!/usr/bin/env python3

import shutil
path = "/"
total, used, free = shutil.disk_usage(path)
print("Total: %d GiB" % (total // (2**30)))
print("used: %d GiB" % (used // (2**30)))
print("free: %d GiB" % (free // (2**30)))

Approach – Part 1

  • Any script is a set of instructions executed line by line
  • To become effective understanding flow of the program/script is essentioal

Lets write a script to install docker

  • create a file ( with following content
curl -fsSL -o
  • Now give execute permissions and run the script <path>/


  • Write a shell script
    • to install jenkins with java 11
    • to install jenkins with java 17
    • to install kubernetes (using kubeadm) skip init
  • Note: all the scripts will be run as a root user

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner