Skip to content

Instantly share code, notes, and snippets.

@d630
Last active June 13, 2016 09:36
Show Gist options
  • Save d630/f7ab96ff1092d6fa3d3340db5eaff985 to your computer and use it in GitHub Desktop.
Save d630/f7ab96ff1092d6fa3d3340db5eaff985 to your computer and use it in GitHub Desktop.
bash: Indentation styles
# tab: 8
# Bourne/Korn/Horstmann
while ((x == 1))
do echo foo
echo bar
done
for ((i=0; i < 10; i++))
do if ((i % 2 == 0))
then echo foo "$i"
else echo fooElse "$i"
echo bar "$i"
fi
done
# Allman/"The UNIX Programming Environment"
while ((x == 1))
do
echo foo
echo bar
done
for ((i=0; i < 10; i++))
do
if ((i % 2 == 0))
then
echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"
fi
done
# GNU
while ((x == 1))
do
echo foo
echo bar
done
for ((i=0; i < 10; i++))
do
if ((i % 2 == 0))
then
echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"
fi
done
# Haskell
while ((x == 1))
do echo foo
echo bar
done
for ((i=0; i < 10; i++))
do if ((i % 2 == 0))
then echo foo "$i"
else echo fooElse "$i"
echo bar "$i"
fi
done
# Whitesmith
while ((x == 1))
do
echo foo
echo bar
done
for ((i=0; i < 10; i++))
do
if ((i % 2 == 0))
then
echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"
fi
done
# Pico
while ((x == 1))
do echo foo
echo bar; done
for ((i=0; i < 10; i++))
do if ((i % 2 == 0))
then echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"; fi; done
# C K&R style
while ((x == 1)); do
echo foo
echo bar
done
for ((i=0; i < 10; i++)); do
if ((i % 2 == 0)); then
echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"
fi
done
# Ratliff
while ((x == 1)); do
echo foo
echo bar
done
for ((i=0; i < 10; i++)); do
if ((i % 2 == 0)); then
echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"
fi
done
# Lisp
while ((x == 1)); do
echo foo
echo bar; done
for ((i=0; i < 10; i++)); do
if ((i % 2 == 0)); then
echo foo "$i"
else
echo fooElse "$i"
echo bar "$i"; fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment