You should use a C-style for loop to accomplish this:
for ((i=1; i<=$1; i++)); do
echo $i
done
This avoids external commands and nasty eval statements.
More Related Contents:
- How do I iterate over a range of numbers defined by variables in Bash?
- Looping over pairs of values in bash [duplicate]
- How to loop over files in directory and change path and add suffix to filename
- Brace expansion with a Bash variable – {0..$foo}
- How to perform a for loop on each character in a string in Bash?
- How to skip the for loop when there are no matching files?
- Looping through alphabets in Bash
- How to parallelize for-loop in bash limiting number of processes
- How do I write a ‘for’ loop in Bash?
- How to add leading zeros for for-loop in shell? [duplicate]
- Loop over tuples in bash?
- Convert absolute path into relative path given a current directory using Bash
- awk in bash with ls and variable
- How to create a cron job using Bash automatically without the interactive editor?
- Convert date time string to epoch in Bash
- How do I put an already-running process under nohup?
- How to obtain the absolute path of a file via Shell (BASH/ZSH/SH)?
- How can I ‘echo’ out things without a newline?
- String comparison in bash. [[: not found
- How to find whether or not a variable is empty in Bash
- Can’t get expand_aliases to take effect
- How to read from a file or standard input in Bash
- Send command to a background process
- Validate date format in a shell script
- How do you return to a sourced bash script?
- Signals received by bash when terminal is closed
- How execute bash script line by line?
- How to update one file in a zip archive
- How to redirect a program that writes to tty?
- What is the proper way to test a Bash function’s return value?