0

I have the following code:

yes "$(echo -e "\xff")" | head -n 10 > SomeFile.bin

Which writes 10 times 0xFF and 0x0A (newline) to SomeFile.bin. But my objective is to fill the file with FF.

Is there a way to print only consecutive 0xFF values instead? Without adding a newline every time?

JCSB
  • 345
  • 2
  • 16

1 Answers1

1

Here is one way:

printf '\xFF%.s' {1..10} >SomeFile.bin
oguz ismail
  • 1
  • 16
  • 47
  • 69