Skip to content

Instantly share code, notes, and snippets.

@akesterson
Created July 17, 2014 21:01
Show Gist options
  • Save akesterson/760a016e95bafc9023b5 to your computer and use it in GitHub Desktop.
Save akesterson/760a016e95bafc9023b5 to your computer and use it in GitHub Desktop.
if [ ... ]; then
do some shit
....
....
....
....
....
if [ ... ]; then
do more shit
...
...
even more shit
lots more shit
if [ ... ]; then
lots and lots of shit
....
..
...
fi
fi
fi
becomes:
function do_nasty_shit()
{
do some shit
....
....
....
....
....
}
function do_super_nasty()
{
do more shit
...
...
even more shit
lots more shit
}
function do_ultra_nasty()
{
lots and lots of shit
....
..
...
}
if [ ... ]; then
do_nasty_shit
if [ ... ]; then
do_super_nasty
if [ ... ]; then
do_ultra_nasty
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment