从bash脚本返回数字

时间:2016-04-13 10:06:42

标签: bash

我有以下bash脚本:

byte_swap () {
# Take "abcdefgh" and return it as "ghefcdab"
echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}"
}

crmagic_hex="4372 3234" # Cr24
version_hex="0200 0000" # 2
pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}')))
sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}')))
(
 echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p
 cat "$pub" "$sig" "$zip"
) > "$crx"

但执行时:

 ./crxmake.sh: line 49: printf: Users: invalid number 
 ./crxmake.sh: line 50: printf: Users: invalid number

这用于为chrom插件生成crx文件。

0 个答案:

没有答案