简体   繁体   中英

export in bash with printf doen't work

I exported:

export FMTSTR="%2\$n'printf "\xc0\xf2\x03\x42";'"

and I want to see the result:

env | grep FMTSTR
FMTSTR=%2$n'printf xc0xf2x03x42;'

but this is not what I want...The result must be :

‫‪FMTSTR=%2$nTB‬‬

Could you possibly tell me what the problem is? secondly can I use python instead of printf? like this:

export FMTSTR="%2\$n $(python -c 'print "\xc0\xf2\x03\x42"')"

when I use python the result is:

FMTSTR=%2$n ��B

why? please give me a help in these two questions.

thank you...

This is not exactly correct (due to the nature of your question), but I feel you may have better luck using this:

export FMTSTR=`python -c 'print "%2$n\xc0\xf2\x03\x42"'`

Now, the \\xc0\\xf2\\x03 has no ascii equivalent. I'm not sure how you're expecting the output TB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM