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 it
frequently.
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, it's assumed
an 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 to
see if it's spelled right?
● This script integrates with ispell to provide
a command line interface for checking one
or more words.
● Usage: $script word1 word2 word3...
● Ex: $script word asdf
5. findman.sh
● This script searches manuals for specified
words.
● 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 or
add to. It chooses one randomly when you
start the game.
● Usage: $script
7. hilow.sh
● Another guessing style game, this one
chooses a random number between 1 and
100, and tells you whether you were too
large or too small each time you guess.
The goal is to guess in as few tries as
possible.
● Usage: $script
8. newrm.sh
● In Linux, there isn't a really good way to
send things to the trash from the terminal.
● This script creates a protected, hidden
folder in your home directory where it
stores files you remove from the command
line.
● NOTE: Make a cron job to keep the folder
clearish, otherwise it will quickly get
massive.
● Usage: $script filename.
9. unrm.sh
● The counterpart of newrm. It searches the
trash directory and returns results.
● Usage: $script filename.
10. normdate.sh
● This script is a great example of a helper
script. It takes a date from a 2/21/2013 format,
and returns Feb 21, 2013.
● This isn't terribly useful on its own, but nice as
an addition to another script.
● Usage: $script 2/21/2013.
11. remindme.sh
● This provides a quick and easy way to search
a specified file for a given term, and returns
that entire line.
● Sooo, if you want a basic “things to remember
list”, and want to store some details, this could
be handy.
● Usage: $script string
12. timein.sh
● Ever wondered what time it was in
Cancun? Or felt too lazy to math out the
difference between here and PST? This will
tell 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 over
again, script it!
● Example: script to disable, un-install, and re-
install a given Drupal module.