-3
#!/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: $X0-$X1"
dd if=/dev/mem bs=4096 skip=$R0 count=$(($R1 - $R0 ))
done
你如何/爲什麼要編譯一個shell腳本?你想要它做什麼?它究竟在做什麼? – Ken 2011-02-07 15:19:50