Script presentation

download Script presentation

If you can't read please download the document

Transcript of Script presentation

  • 1. Shell Scripting for Fun and Profit!Brought to you by Spyderbyte Design with credit to www.intuitive.com for some awesome scripts.

2. Running Scripts To run a shell script, typically the syntax is:sh path/to/script.sh. This is awkward, and irritating if you use itfrequently. 3. Aliases to the Rescue! Aliases are stored in/home/user/.bash_aliases. They are written in the form: alias untar=tar-zxvf So for all of these shell scripts, its assumedan alias will be made for them, it will be just$script for sake of clarity. 4. checkspelling.sh Ever wanted to just quickly check a word tosee if its spelled right? This script integrates with ispell to providea command line interface for checking oneor more words. Usage: $script word1 word2 word3... Ex: $script word asdf 5. findman.sh This script searches manuals for specifiedwords. Usage: $script manualtosearch string(s). Ex: $script siege test 6. guessword.sh A word guessing game Hangman style. It has preset words that you can change oradd to. It chooses one randomly when youstart the game. Usage: $script 7. hilow.sh Another guessing style game, this onechooses a random number between 1 and100, and tells you whether you were toolarge or too small each time you guess.The goal is to guess in as few tries aspossible. Usage: $script 8. newrm.sh In Linux, there isnt a really good way tosend things to the trash from the terminal. This script creates a protected, hiddenfolder in your home directory where itstores files you remove from the commandline. NOTE: Make a cron job to keep the folderclearish, otherwise it will quickly getmassive. Usage: $script filename. 9. unrm.sh The counterpart of newrm. It searches thetrash directory and returns results. Usage: $script filename. 10. normdate.sh This script is a great example of a helperscript. It takes a date from a 2/21/2013 format,and returns Feb 21, 2013. This isnt terribly useful on its own, but nice asan addition to another script. Usage: $script 2/21/2013. 11. remindme.sh This provides a quick and easy way to searcha specified file for a given term, and returnsthat entire line. Sooo, if you want a basic things to rememberlist, and want to store some details, this couldbe handy. Usage: $script string 12. timein.sh Ever wondered what time it was inCancun? Or felt too lazy to math out thedifference between here and PST? This willtell you. Usage: $script PST, Europe/Dublin,America/Cancun. 13. Your Options are Limitless Scripting is only limited by imagination. If you have something you do over and overagain, script it! Example: script to disable, un-install, and re-install a given Drupal module. 14. Questions?