Brace expansion, {x..y} is performed before other expansions, so you cannot use that for variable length sequences.
Instead, use the seq 2 $max
method as user mob stated.
So, for your example it would be:
max=10
for i in `seq 2 $max`
do
echo "$i"
done
More Related Contents:
- Replace a string in shell script using a variable
- How to delete duplicate lines in a file without sorting it in Unix
- Identifying and removing null characters in UNIX
- Why do shell script comparisons often use x$VAR = xyes?
- Is there a Unix utility to prepend timestamps to stdin?
- Use grep –exclude/–include syntax to not grep through certain files
- Is PowerShell ready to replace my Cygwin shell on Windows? [closed]
- How do I set $PATH such that `ssh user@host command` works?
- How to do a mass rename?
- Date arithmetic in Unix shell scripts
- How do I manipulate $PATH elements in shell scripts?
- What is the general syntax of a Unix shell command?
- Convert decimal to hexadecimal in UNIX shell script
- unix command line execute with . (dot) vs. without
- Diff files present in two different directories
- How do I change a shell scripts character encoding?
- Creating string of repeated characters in shell script [duplicate]
- In a unix shell, how to get yesterday’s date into a variable?
- How to pass command output as multiple arguments to another command
- Why equal to operator does not work if it is surrounded by space?
- Which characters need to be escaped when using Bash?
- Force line-buffering of stdout in a pipeline
- Setting environment variables in Linux using Bash
- How to grep for the whole word
- How do I syntax check a Bash script without running it?
- Need to link cmake project to dl library
- Why do programs in Unix-like environments have numbers after their name? [duplicate]
- How to get a unix script to run every 15 seconds?
- How do you normalize a file path in Bash?
- Command-line Unix ASCII-based charting / plotting tool