我说,用印本做是新鲜事,但我不敢肯定如何做。 我有一个指挥,试图在具体的道路上安装一个磁盘。 综合安全分遣队1被定义为在某个特定USB港口进行特别的SSD驱使——这里并不重要。
/bin/mount DISK1 ${MOUNT_PATH}
我现在要检查这一增长是否成功。 通常,如果这一表述成功的话,它就会回去,但一旦出现错误,表达就会回去32。
if [$? -eq 0]; then
echo "Mounted DISK 1 at ${MOUNT_PATH}"
elif [$? -eq 32]; then
echo "DISK 1 read error"
else
echo "FAILED TO MOUNT"
fi
When this script ran, and the expression came back as 32, it went to the elif block, but then I got a "command not found" for this. I assume that because "$?" had already been evaluated, so you can t call "$?" again?
So how would you get it to run the mount expression evaluation again and do a 32 -eq 32 comparison so that it can run the "DISK 1 read error"?
储存评价是解决这一问题的方法吗? 该法典是否可行? 由于磁盘重读错误需要几天才能显示,我很难测试该代码。
/bin/mount DISK1 ${MOUNT_PATH}
$mnt_stat = $?
if [$mnt_stat -eq 0]; then
echo "Mounted DISK 1 at ${MOUNT_PATH}"
elif [$mnt_stat -eq 32]; then
echo "DISK 1 read error"
else
echo "FAILED TO MOUNT"
fi