Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash printf + echo string

Tags:

bash

echo

printf

So I'm trying to print a string as a argument to a program in the terminal. However, my command doesn't seem to match the string, which I need. The string I need to print is:

aaaaa$'\x14\x84\x04\x08'

My command:

`printf 'a%.0s' {1..76}; echo "$'\x14\x84\x04\x08'"`

Am I just making a stupid mistake?

like image 481
Niels Sønderbæk Avatar asked Aug 28 '26 07:08

Niels Sønderbæk


1 Answers

Try like this,

~$ printf %76s |tr " " "a"; echo "$'\x14\x84\x04\x08'"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$'\x14\x84\x04\x08'
like image 120
Adem Öztaş Avatar answered Aug 30 '26 08:08

Adem Öztaş



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!