Shell Scripting Pt. 3

Practical Scripts

Personal Task Manager

  • Two scripts
  • Add a task
  • Find and display tasks
    • Weekly, annual, and single entry
    • Test for bad/incompatible formatting
    • Save the data to a hidden file
    • Second script changes current date into dayname, day and month, or day, month, and year
    • String comparison
    • Print tasks

Largest Disk Occupancy

  • Loop through /etc/passwd (use cut to grab username and awk to iterate only UID over 99)
  • Use find and -xdev to specific certian directories (saves time)
  • Closing awk statement that only prints to accounts that have exceeded specified disk space
  • Modify/evolve script to e-mail users that have excessive disk space

Provisioning Tool

  • Uses virt-install
  • Default values for RAM, CPU, and disk size
  • CLI arguments to include values and override defaults if necessary
  • Test for empty name and break out of script

Additional Resources

this is a good tool too

https://ss64.com/

1 Like