Domanda

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?

È stato utile?

Soluzione 2

¿Something like this?

 `printf "%76s"; echo "$'\x14\x84\x04\x08'"`

If do you want to print the hex characters:

 `printf "%76s"; echo $'\x14\x84\x04\x08'`

Is recommended to use the dollar sign and parentheses instead of backticks:

 $(printf "%76s"; echo "$'\x14\x84\x04\x08'")

Or

 $(printf "%76s"; echo $'\x14\x84\x04\x08')

Altri suggerimenti

Try like this,

~$ printf %76s |tr " " "a"; echo "$'\x14\x84\x04\x08'"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$'\x14\x84\x04\x08'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top