Skip to content

Instantly share code, notes, and snippets.

@sosukeinu
Created January 29, 2013 16:32
Show Gist options
  • Save sosukeinu/4665588 to your computer and use it in GitHub Desktop.
Save sosukeinu/4665588 to your computer and use it in GitHub Desktop.
BASH comma-separated list of numbers
#!/bin/bash
echo "Input variable #1 "
read var1
echo "variable #1 = $var1"
echo
echo "Input variable #2 "
read var2
echo "variable #2 = $var2"
echo
# ------------------------------------------- #
# As with "for" and "while" loops,
#+ an "until" loop permits C-like test constructs.
until (( var1 > var2 ))
do # ^^ ^ ^ ^^ No brackets, no $ prefixing variables.
echo -n "$var1,"
(( var1++ ))
done # 0,1,2,3,4,5,6,7,8,9,10,
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment