printf 现在在我的输出中

printf 现在在我的输出中

加密开启这个问题变得更有趣了。我从这个脚本开始:

while read CTFlist; do 

#next we need to create ctfs padded with zeros as a variable
ctfPadded=(printf ${ctflist}00000000)

#then call rc2 key as variable
rc2Key="TemporaryRC2Key1"

#next create a hex version of the rc2 key
hexRc2Key=$(printf "${rc2Key}"|xxd -p)

#next to create the encrypted ctf file using the hex rc2 key
ctfEnc= $(printf "${ctfPadded}" |xxd -r -p |openssl enc -rc2-cbc -nopad -K "${hexRc2Key}" -iv 0000000000000000 |xxd -plain|tr -d '\n')

#Now we call all our variables and output to a single file.
echo ${ctfPadded},${ctfEnc^^} >> output.csv

#calling end of file with the input file of ctflist.csv
done <CTFlist.csv

#have to change the output file to dos version or it wont open on a windows comp
unix2dos output.csv

Output.csv 文件列表中的每一行都有 printf 。为什么?什么是不正确的?

答案1

您在此处省略了命令替换中的美元符号:

ctfPadded=(printf ${ctflist}00000000)

这一行应该是:

ctfPadded=$(printf ${ctflist}00000000)

相关内容