Skip to main content
Literal references of text elements should be placed in inline-code, not boldface
Source Link
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

In this case, %.0s always prints one instance of character(s) preceding it, HH in this case. When you use {1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.

In this case, %.0s always prints one instance of character(s) preceding it, H in this case. When you use {1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.

In this case, %.0s always prints one instance of character(s) preceding it, H in this case. When you use {1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.

In this case, %.0s always prints one instance of character(s) preceding it, HH in this case. When you use {1..5000}{1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printfprintf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.

In this case, %.0s always prints one instance of character(s) preceding it, H in this case. When you use {1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.

In this case, %.0s always prints one instance of character(s) preceding it, H in this case. When you use {1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.

Source Link
KM.
  • 2.3k
  • 2
  • 19
  • 26

In this case, %.0s always prints one instance of character(s) preceding it, H in this case. When you use {1..5000}, the shell expands it and it becomes:

printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt

i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:

printf 'H%.0s' a bc fg 12 34

prints HHHHH -- i.e., the number of arguments, 5 in this case.

Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.