遍历一个词的不同变体

Loop through different variations of a word

我想遍历一个词的不同变体,但想不出语法如何安排,例如:

for host in server(01,02,03,04)db
    do echo $host
done

会 return:

server01db
server02db
server03db
server04db

我将如何构造该循环?

使用大括号代替圆括号:

for host in server{01,02,03,04}db 
do
  echo "$host"
done

查看 man bash Brace Expansion

另一个:

$ for host in server{01..04}db 
  do
    echo "$host"
  done