开发者

after compiling It gives some weird characters .please explain how to compile

#!/bin/sh

 if [[ $# -ne 0 ]]; then    
    echo "USAGE: $0"    
    exit 1    
 fi


  grep '^[^ ].*$' /proc/iomem | grep 'System RAM' | while read -r LINE; do

    X0="0x`echo $LINE | sed 's|^\([^-]*\)-.*|\1|'`"

    X1="0x`echo $LINE | sed 's|^[^-]*-\([^ ]*\) .*|\1|'`"


    R0=$(( ($(printf %d $X0) / 4096)))

    R1=$(( ($(printf %d $X1) / 4096)))

 if [ $(( $(printf %d $X1) % 4096 )) -ne 0 ]; then

        R1=$(( $R1 + 1 ))

  fi



    echo "CHUNK: $X开发者_如何学编程0-$X1"

    dd if=/dev/mem bs=4096 skip=$R0 count=$(( $R1 - $R0  ))

done


Your script dumps memory to its output, if you want this to be formatted (as say, hex), you should pass it through xxd or od

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜