[script]判定dd是否成功

判定方式

#!/bin/bash

dd if=hello of=hello.c 2> result.dd
retval=`grep "copied" result.dd    | awk '{print $1}'`
filesize=`ls -l ./ | grep 'hello.sh' |awk '{print $5}'`
# echo retval: $retval
# echo filesize: $filesize

if [ $retval -eq $filesize ]; then
echo result: pass
else
echo result: failure
fi

exit 0
原文地址:https://www.cnblogs.com/aaronLinux/p/7688068.html