There are two choices.
The first uses the
range brackets found in regular expressions and globbing.
Code:
rm file.[1-10]
rm file.[1-9]
# Looks in the directory for file.1 file.2 file.3 ... file.10 file.9
# then runs "rm <matching files>"
rm file.[1-9] file.[1-2][0-9]
# runs on file.1 to file.9, and then file.10 to file.29
This looks first to see what files match the range given, then substitutes their filenames in the final command. rm only gets a list of whatever files exist in that sequence. If no files exist, it will treat it as a literal
"file.[1-10]" "file.[1-9] (which will likely not match anything). This is probably your safest choice here.
[ Edit the next day: Sorry, messed up yesterday. The regex range expression will only match single digits/characters. You have to get a bit more creative when matching multi-digit numbers, particularly when trying to match both single and multi-digit numbers at the same time. ]
The second option is to use
brace expansion. The braces generate a series of text strings, one for each step in the range.
Code:
rm file.{1..10}
# Equivalent to running "rm file.1 file.2 file.3 ... file.10"
In this case, rm is simply given a list of 10 files to attempt to remove. Since it generates one command for each number, separate errors will occur for each file not found.
Brace expansion is usually used more for commands that create series' of files instead.
Code:
touch file.{1..10} #creates a series of 10 empty text files
Note that
bash version 4 has introduced zero-padding and incrementing by steps in brace expansion.