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
Related Posts:
- How to read a file into a variable in shell?
- How do I pause my shell script for a second before continuing?
- How to pretty print XML from the command line?
- In the shell, what does ” 2>&1 ” mean?
- What are file descriptors, explained in simple terms?
- In the shell, what does ” 2>&1 ” mean?
- How to concatenate string variables in Bash
- How to kill a process running on particular port in Linux?
- Display exact matches only with grep
- How can I check if a directory exists in a Bash shell script?
- How do I iterate over a range of numbers defined by variables in Bash?
- OS X: equivalent of Linux’s wget
- How to split a delimited string into an array in awk?
- How do I iterate over a range of numbers defined by variables in Bash?
- OS X: equivalent of Linux’s wget
- Display exact matches only with grep
- What does “-ne” mean in bash?
- What is the purpose of “&&” in a shell command?
- What does ^M character mean in Vim?
- Who can access a file with octal permissions “000” on Linux/UNIX?
- What does it mean to write to stdout in C?
- What does the line “#!/bin/sh” mean in a UNIX shell script?
- What do ‘real’, ‘user’ and ‘sys’ mean in the output of time(1)?
- mkdir’s “-p” option
- Given two directory trees, how can I find out which files differ by content?
- Which characters need to be escaped when using Bash?
- wait(null) and wait(&status) C language and Status
- Diff command along with Grep gives “Binary file (standard input) matches”
- How to get the current directory in a C program?
- When could or should I use chmod g+s on a file or directory?
- How to Sum a column in AWK?
- Equivalent of *Nix ‘which’ command in PowerShell?
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- What is the difference between SIGSTOP and SIGTSTP?
- How to colorize diff on the command line
- How to colorize diff on the command line
- Command to change the default home directory of a user
- Is there any simple way to benchmark Python script?
- Sorting data based on second column of a file
- gpg decryption fails with no secret key error
- Variable interpolation in the shell
- What is the difference between tar and zip?
- Display current path in terminal only
- What does “&” at the end of a linux command mean?
- Syntax error near unexpected token ‘then’
- What do the dup() and dup2() systems really do?
- Shell script not running, command not found
- Using grep and ls -a commands
- What generates the “text file busy” message in Unix?
- Reasoning behind C sockets sockaddr and sockaddr_storage
- Difference between sh and Bash
- What are the uses of the exec command in shell scripts?
- How can I send an email through the UNIX mailx command?
- Rename multiple files based on pattern in Unix
- What is the difference between a symbolic link and a hard link?
- SCP Permission denied (publickey). on EC2 only when using -r flag on directories
- binary operator expected error when checking if a file with full pathname exists
- What is special about /dev/tty?
- How do I do ‘mount –bind’ in /etc/fstab?
- How to read backward from the end of file in less or more?
- What does ‘set -e’ do, and why might it be considered dangerous?
- Getting the last match in a file using grep
- What does “:=” mean in Pseudocode? [closed]
- Arrow operator (->) usage in C
- How to execute a program or call a system command?
- How do you comment out code in PowerShell?
- -bash: syntax error near unexpected token `)’
- `from … import` vs `import .` [duplicate]
- All possible array initialization syntaxes
- PHP “or” Syntax
- How to make “if not true condition”?
- How do you express binary literals in Python?
- Connect: Socket operation on non-socket
- What is the difference between syntax and semantics in programming languages?
- Using find to locate files that match one of multiple patterns
- “unary operator expected” error in Bash if condition
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- What do << or >>> in java mean?
- Is there a Python equivalent to the ‘which’ command
- How do I split a string on a delimiter in Bash?
- How can I count all the lines of code in a directory recursively?
- How can I kill a process by name instead of PID, on Linux?
- Extract file basename without path and extension in bash
- Shell: How to call one shell script from another shell script?
- SyntaxError invalid token
- ./configure : /bin/sh^M : bad interpreter
- What is cp: cannot stat error in Unix, I get this error when trying to copy thing from one folder to another
- Is there a difference between x++ and ++x in java?
- What does ‘=' mean in PHP?
- Using ls to list directories and their total sizes
- What does set -e mean in a bash script?
- What is `S_ISREG()`, and what does it do?
- Restarting cron after changing crontab file?
- cd into directory without having permission
- How to parse XML in Bash?
- grep for special characters in Unix
- How do I change my private key passphrase?
- How do I get the current Unix time in milliseconds in Bash?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?