
开场白
1、printfprintf 是 Linux 中的一个命令,用于格式化输出文本或数据。它类似于 C 语言中的 printf 函数。
printf '%s\n' {1..10}
method of printf
2、seq`seq` 是 Linux 中的一个命令,用于生成一系列连续的数字。它可以用于创建数字序列,例如 1、2、3 等等。seq用法如下:
seq (-w) (-f format) (-s string) (-t string) (first (incr)) last参数说明:-f format:格式化输出,使用 printf 的格式来打印数字。默认值为%g。-s string:使用字符串分隔数字。默认值为\n,即换行。-t string:使用字符串终止数字序列。-w:根据输出需要通过填充零来保证所有数字的宽度一致。与-f 选项一起用时无效。first:首位数字。incr:步进数字。last:末尾数字。seq 1 10
method of seq
3、for循环Linux 中的 for 循环是一种强大的命令行工具,它允许你在一系列的值上执行重复的操作。
for i in {1..10}; do echo "$i"; done
method of for