开发者

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

开发者 https://www.devze.com 2023-02-08 20:17 出处:网络
#!/bin/sh if [[ $# -ne 0 ]]; then echo \"USAGE: $0\" exit 1 fi grep \'^[^ ].*$\' /proc/iomem | grep \'System RAM\' | while read -r LINE; do
#!/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

精彩评论

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