Teach an Old Shell New Tricks With BashDiff

Written By
Web Webster
Web Webster
Oct 29, 2008

“BashDiff extends the for, while, and until commands to include
optional then and else blocks following the main loop block. These
new optional then/else blocks let you perform an action after a
normal iteration of the block (the then block) and a block of
commands when the break command is used (the else block). Using the
else block is useful if you want to see if the loop was terminated
early using the break command.

“Bash 3 includes the sequence generation expression {1..100},
which expands to a space-separated sequence of the numbers between
1 and 100. In standard bash you cannot set these minimum and
maximum values using shell variables but must fall back to using
the seq command. BashDiff allows you to use variables, as the
following example shows:”

Complete
Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.